Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The Events Calendar // Filter main query example
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