Tribe__Events__Templates::setup_ecp_template( WP_Query $query )
This is where the magic happens where we run some ninja code that hooks the query to resolve to an events template.
Contents
Parameters
- $query
-
(WP_Query) (Required)
Source
File: src/Tribe/Templates.php
public static function setup_ecp_template( $query ) {
do_action( 'tribe_events_filter_the_page_title' );
if ( self::is_main_loop( $query ) && self::$wpHeadComplete ) {
// on loop start, unset the global post so that template tags don't work before the_content()
add_action( 'the_post', array( __CLASS__, 'spoof_the_post' ) );
// on the_content, load our events template
add_filter( 'the_content', array( __CLASS__, 'load_ecp_into_page_template' ) );
// remove the comments template
add_filter( 'comments_template', array( __CLASS__, 'load_ecp_comments_page_template' ) );
// only do this once
remove_action( 'loop_start', array( __CLASS__, 'setup_ecp_template' ) );
}
}