Order by End Date

Home Forums Calendar Products Events Calendar PRO Order by End Date

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #986559
    Neasa Ronayne
    Participant

    Hi,

    Wasn’t sure how to share this but this is a post about solving the order by end date issue.

    Here is the code:

    global $post;
    			$upcoming=tribe_get_events( array(
    				'post_type'=>'tribe_events',
    				'eventDisplay'=>'upcoming',
    				'showposts' => '-1')
    			);
    			$upcoming = new WP_Query();
    			$upcoming->query( array(
    				'meta_key'=> '_EventEndDate',
    				'orderby'=>'meta_value_num',
    				'post_type'=>'tribe_events',
    				'eventDisplay'=>'upcoming',
    				'showposts' => '-1')
    			);
    
    			if ($upcoming->have_posts()) :
    			while ($upcoming->have_posts()) : $upcoming->the_post();
    echo tribe_get_start_date(get_the_ID()).' - '.tribe_get_end_date();
    endwhile; endif; wp_reset_query();

    Note I have the variable $upcoming filled twice with two different arrays without this it does not work for some reason. So this works but I am not sure why.
    Please feel free to share and enjoy 😀

    #986782
    Brian
    Member

    Hi,

    Thanks for sharing the coding.

    That is a little strange with the two $upcoming, but glad it worked out for you.

    Cheers

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Order by End Date’ is closed to new replies.