javascript - Can you remove wordpress post tags with js/php after certain date (ACF date time picker)? -


so website lists upcoming film screenings in area.

i'm using acf date time picker show posts/film screenings in future in wordpress loop.

i have tags filtering results dynamically using ajax (thanks https://www.bobz.co/ajax-filter-posts-tag/) except there tags aren't relevant results because belong posts older current date (past screenings).

*for example on website, 'animated film festival' still coming other tags.

i don't know if it's possible delete posts tags php (within post template while loops through other posts) - , delete posts tags if acf date time field post older current date.

i haven't found luck googling , bit of noob so...

this site: http://pigcine.pamrosel.com/ i'm doing in functions.php file @ moment:

// tags , display function tags_filter() {     $tax = 'post_tag';     $terms = get_terms( $tax );     $count = count( $terms );      if ( $count > 0 ): ?>         <div class="post-tags">         <?php         foreach ( $terms $term ) {              $term_link = get_term_link( $term, $tax );             echo '<a href="' . $term_link . '" class="tax-filter"         title="' . $term->slug . '">' . $term->name . '</a> ';         } ?>                </div>     <?php endif; }  // script getting posts function ajax_filter_get_posts( $taxonomy ) {  // verify nonce if( !isset( $_post['afp_nonce'] ) || !wp_verify_nonce($_post['afp_nonce'], 'afp_nonce' ) ) die('permission denied');  $taxonomy = $_post['taxonomy'];  // wp query $args = array( 'tag' => $taxonomy, 'post_type' => 'post', 'posts_per_page' => -1, 'meta_key'  => 'datetime',         'orderby'    => array(         'datetime' => 'asc'         ), );  // if taxonomy not set, remove key array , posts if( !$taxonomy ) { unset( $args['tag'] ); }  $query = new wp_query( $args );  if ( $query->have_posts() ) : while($query->have_posts()) : $query>the_post();  $today = date('y-m-d h:i:s', strtotime('+9 hours')); $event_date = get_field('datetime'); if (strtotime($today) <= strtotime($event_date)) { ?>  <div class="sl">  <div class="sl_closed">      <div class="col-2-8"><div class="modulepad">      <p><?php the_field('datetime'); ?></p>     </div></div>      <div class="col-3-8"><div class="modulepad">      <p><?php the_title(); ?><br>      <?php $wpmovieinput = get_field('movie_title'); $movie = imdb_connector_get_movie($wpmovieinput); echo implode(", ", $movie["directors"]); ?>      </p>     </div></div>      <div class="col-3-8"><div class="modulepad">      <p><?php the_field('location_name'); ?><br>      <?php $wpmovieinput = get_field('movie_title'); $movie = imdb_connector_get_movie($wpmovieinput); echo implode(", ", $movie["countries"]) . " "; echo $movie["released"] . " "; echo implode(", ", $movie["runtime"]); ?>      </p>     </div></div>  </div><!--sl_closed-->   <?php } endwhile; ?> <?php else: ?>  <h2>no posts found</h2> <?php endif;  die(); }  add_action('wp_ajax_filter_posts', 'ajax_filter_get_posts'); add_action('wp_ajax_nopriv_filter_posts', 'ajax_filter_get_posts'); 


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -