Skip to content

Instantly share code, notes, and snippets.

@jmarchwinski
Created November 1, 2017 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmarchwinski/8ee4777a7894d2f5cbe6c761b6826070 to your computer and use it in GitHub Desktop.
Save jmarchwinski/8ee4777a7894d2f5cbe6c761b6826070 to your computer and use it in GitHub Desktop.
Photo View Reverse Chronology
// Changes PHOTO VIEW listed event views to reverse chronological order
function tribe_past_reverse_chronological ($post_object) {
$past_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $_REQUEST['tribe_event_display'] === 'upcoming') ? true : false;
if(tribe_is_past() || tribe_is_photo() || tribe_is_upcoming() || $past_ajax) {
$post_object = array_reverse($post_object);
}
return $post_object;
}
add_filter('the_posts', 'tribe_past_reverse_chronological', 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment