Created
November 10, 2015 14:50
-
-
Save geoffgraham/b3e17ea1bb2a6464b119 to your computer and use it in GitHub Desktop.
The Events Calendar // Filter main query example
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
add_action( 'pre_get_posts', 'order_by_modified' ); | |
function order_by_modified( $query ) { | |
if ( $query->is_home() && $query->is_main_query() ) { | |
$query->set( | |
'post_type' => 'tribe_events', | |
'orderby' => 'modified', | |
'posts_per_page' => 1 | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment