Template_Bootstrap::filter_template_file( string $file, array $name, object $template )

Filter the template file in case we’re in single event and we need to use the theme overrides.


Parameters

$file

(string) (Required) Complete path to include the PHP File

$name

(array) (Required) Template name

$template

(object) (Required) Instance of the Tribe__Template


Top ↑

Return

(string)


Top ↑

Source

File: src/Tribe/Views/V2/Template_Bootstrap.php

	public function filter_template_file( $file, $name, $template ) {
		$template_name = end( $name );

		// Bail when we dont are not loading 'default-template'.
		if ( 'default-template' !== $template_name ) {
			return $file;
		}

		if (
			! is_singular( TEC::POSTTYPE )
			&& 'single-event' !== tribe_context()->get( 'view' )
		) {
			return $file;
		}

		$theme_file = locate_template( 'tribe-events/default-template.php', false, false );

		if ( ! $theme_file ) {
			return $file;
		}

		if ( ! tribe_is_showing_all() && tribe_is_past_event() ) {
			Tribe__Notices::set_notice( 'event-past', sprintf( esc_html__( 'This %s has passed.', 'the-events-calendar' ), tribe_get_event_label_singular_lowercase() ) );
		}

		return $theme_file;
	}

Top ↑

Changelog

Changelog
Version Description
5.0.0 Introduced.