Created
February 12, 2020 16:53
-
-
Save jesseeproductions/c86db575a6cb8000a638236842091d31 to your computer and use it in GitHub Desktop.
Changes Past Event Reverse Chronological Order in New Views
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 ); |
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
It is not going to work on Summary view as that groups events in a different way than the list views.