Skip to content

Instantly share code, notes, and snippets.

@elimn
Last active December 2, 2019 18:38
Show Gist options
  • Save elimn/0be6c4cbcf80b3721c81 to your computer and use it in GitHub Desktop.
Save elimn/0be6c4cbcf80b3721c81 to your computer and use it in GitHub Desktop.
MT | TEC | Change past event views to reverse chronological order
<?php
// Changes past event views to reverse chronological order
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);
@Daimda
Copy link

Daimda commented Oct 29, 2015

Hey guys,
when I past the code in function.php I receive this error:

Fatal error: Call to undefined function tribe_is_past() in /web/htdocs/www.selvaurbana.it/home/wp-content/themes/SF-child/functions.php on line 4

Do you know why?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment