Tribe__Events__Templates::init()

Initialize the Template Yumminess!


Source

File: src/Tribe/Templates.php

		public static function init() {

			// Choose the wordpress theme template to use
			add_filter( 'template_include', array( __CLASS__, 'templateChooser' ) );

			// include our view class
			add_action( 'template_redirect', 'tribe_initialize_view' );

			// make sure we enter the loop by always having some posts in $wp_query
			add_action( 'wp_head', array( __CLASS__, 'maybeSpoofQuery' ), 100 );

			// maybe modify the global post object to blank out the title
			add_action( 'tribe_tec_template_chooser', array( __CLASS__, 'maybe_modify_global_post_title' ) );

			// don't query the database for the spoofed post
			wp_cache_set( self::spoofed_post()->ID, self::spoofed_post(), 'posts' );
			wp_cache_set( self::spoofed_post()->ID, array( true ), 'post_meta' );

			// there's no template redirect on ajax, so we include the template class right before the view is included
			if ( tribe_is_ajax_view_request() ) {
				add_action( 'admin_init', 'tribe_initialize_view' );
			}

			add_action( 'wp_head', array( __CLASS__, 'wpHeadFinished' ), 999 );

			// add the theme name to the body class when needed
			if ( self::needs_compatibility_fix() ) {
				add_filter( 'body_class', array( __CLASS__, 'theme_body_class' ) );
			}

			add_filter( 'get_post_time', array( __CLASS__, 'event_date_to_pubDate' ), 10, 3 );
		}