Support » Plugin: The Events Calendar » How to sort the event list.

  • According to, 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);

Viewing 1 replies (of 1 total)
  • Hi kimipooh,

    That is correct, tribe_get_events() will ignore ordering and use it’s own based on the ‘eventDisplay’ arg. If you want to use your own ordering you could also use WP_Query:

    I hope that helps but let me know if you have any other questions.

    – Jonah

Viewing 1 replies (of 1 total)
  • The topic ‘How to sort the event list.’ is closed to new replies.