solution for »show only future events with custom query«

Home Forums Calendar Products Community Events solution for »show only future events with custom query«

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1095264
    Marion
    Participant

    Hi there,

    maybe its still interesting for someone,

    I was able to solve this question
    ( https://theeventscalendar.com/support/forums/topic/order-of-events-showing-events-by-post-date/#dl_post-1057609 )

    by using this code:

    <?php 
    
      $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
    
      $query_args = array(
      	  'suppress_filters' => true,
          'post_type' => 'tribe_events',
     	   'order'    => 'DESC',
          'posts_per_page' => -1,
          'paged' => $paged,
          'page' => $paged,
          
          'meta_query' => array( 
                array(
                    'key' => '_EventEndDate', 
                    'value' => date("Y-m-d"), 
                    'compare' => '>=', 
                    'type' => 'NUMERIC,' 
                    )
                ),
          
          
        );
    
      $the_query = new WP_Query( $query_args ); ?>
    
      <?php if ( $the_query->have_posts() ) : ?>
    
        <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

    Best
    Marion

    #1095293
    Brook
    Participant

    Awesome! Thank you for sharing this Marion. I will be sure to point it out to future users looking for a similar customization. Really appreciate your contribution!

    • Brook
    #1101979
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘solution for »show only future events with custom query«’ is closed to new replies.