right order of past events only after reload
-
In order to sort past events with the latest event on top, I added this to my custom functions.php:
function tribe_past_reverse_chronological ($post_object) { $past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'past') ? true : false; if(tribe_is_past() || $past_ajax) { $post_object = array_reverse($post_object); } return $post_object; } add_filter('the_posts', 'tribe_past_reverse_chronological', 100);
It works, unless I click on the “past events” (“Vorherige Veranstaltungen”) from the list of future events: In this case, all past events are sorted with the first on top. Only after reloading the page, the events appear in the correct order.
You can check this behavior here:
1. go to the list of current events:
https://impact-akademie.com/veranstaltungen/list/?tribe_paged=1&tribe_event_display=list2. select “Vorherige Veranstaltungen”
3. Please reload to see the order changing.
Thanks for ideas on why this happens and how I can display past events in the right order on first loading the page.
- The topic ‘right order of past events only after reload’ is closed to new replies.