How to sort the event list.
-
According to http://tri.be/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events, the event values getting by tribe_get_events() are sorted by event date (order) ascending.
I would like to change the sort type (descending), but I understand that tribe_get_events() cannot support the “orderby”. Is it right?In other words, the following “DESC” value is ignored.
$events = tribe_get_events( array( 'eventDisplay'=>'all', 'posts_per_page'=>5, 'order' => DESC ) );I have used the following other way, but I hope to expand the function.
* WP_Post was supported by WordPress 3.5 or above version.
$events = tribe_get_events( array( 'eventDisplay'=>'all', 'posts_per_page'=>5); $s_date = array(); foreach ($events as $v){ $vc = new WP_Post($v); $vv = $vc->to_array(); $s_date[] = $vv['EventStartDate']; } array_multisort($s_date, SORT_DESC, $events);
The topic ‘How to sort the event list.’ is closed to new replies.