Created
March 15, 2018 15:23
-
-
Save barryhughes/ec630ab11861be053386de5fa5dc9f2d to your computer and use it in GitHub Desktop.
Reverses the order of posts on each individual photo view page (but does not reverse the sequence as a whole ... for TEC/ECP 4.5/4.6). In other words, this doesn't necessarily mean we'll see the furthest-in-the-future event first, rather it means each page on photo view will contain the same range of events but in the reverse order.
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
<?php | |
function photo_view_reorder_posts( $posts ) { | |
remove_filter( 'the_posts', 'photo_view_reorder_posts' ); | |
return array_reverse( $posts ); | |
} | |
function photo_view_reorder_listen( $query ) { | |
if ( | |
'photo' === $query->get( 'eventDisplay' ) | |
|| tribe_is_ajax_view_request( 'photo' ) | |
) { | |
add_filter( 'the_posts', 'photo_view_reorder_posts' ); | |
} | |
} | |
add_action( 'tribe_events_pre_get_posts', 'photo_view_reorder_listen' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment