Tribe__Events__Templates::maybeSpoofQuery()
Decide if we need to spoof the query.
Source
File: src/Tribe/Templates.php
public static function maybeSpoofQuery() {
// hijack this method right up front if it's a password protected post and the password isn't entered
if ( is_single() && post_password_required() || is_feed() ) {
return;
}
$wp_query = tribe_get_global_query_object();
if ( $wp_query->is_main_query() && tribe_is_event_query() && tribe_get_option( 'tribeEventsTemplate', 'default' ) != '' ) {
// we need to ensure that we always enter the loop, whether or not there are any events in the actual query
$spoofed_post = self::spoofed_post();
$GLOBALS['post'] = $spoofed_post;
$wp_query->posts[] = $spoofed_post;
$wp_query->post_count = count( $wp_query->posts );
$wp_query->spoofed = true;
$wp_query->rewind_posts();
}
}