Skip to content

Instantly share code, notes, and snippets.

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 jesseeproductions/c86db575a6cb8000a638236842091d31 to your computer and use it in GitHub Desktop.
Save jesseeproductions/c86db575a6cb8000a638236842091d31 to your computer and use it in GitHub Desktop.
Changes Past Event Reverse Chronological Order in New Views
/**
* Changes Past Event Reverse Chronological Order
*
* @param array $template_vars An array of variables used to display the current view.
*
* @return array Same as above.
*/
function tribe_past_reverse_chronological_v2( $template_vars ) {
if ( ! empty( $template_vars['is_past'] ) ) {
$template_vars['events'] = array_reverse( $template_vars['events'] );
}
return $template_vars;
}
// Change List View to Past Event Reverse Chronological Order
add_filter( 'tribe_events_views_v2_view_list_template_vars', 'tribe_past_reverse_chronological_v2', 100 );
// Change Photo View to Past Event Reverse Chronological Order
//add_filter( 'tribe_events_views_v2_view_photo_template_vars', 'tribe_past_reverse_chronological_v2', 100 );
@jesseeproductions
Copy link
Author

It is not going to work on Summary view as that groups events in a different way than the list views.

@burlingtonpress
Copy link

OK, I've figured out how to make list do what I want, so that's fine. However, I'm having a new problem with this code conflicting with tribe_get_custom_fields(). I'm using code to show additional fields in the list view, and it works fine until I implement this code, at which point it no longer pulls any data. Any thoughts?

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