Tribe__Template::get_template_file( mixed $name )
Tries to locate the correct file we want to load based on the Template class configuration and it’s list of folders
Parameters
- $name
-
(mixed) (Required) File name we are looking for.
Return
(string)
Source
File: src/Tribe/Template.php
public function get_template_file( $name ) { // If name is String make it an Array if ( is_string( $name ) ) { $name = (array) explode( '/', $name ); } $folders = $this->get_template_path_list(); foreach ( $folders as $folder ) { $folder['path'] = trim( $folder['path'] ); if ( ! $folder['path'] ) { continue; } // Build the File Path $file = implode( DIRECTORY_SEPARATOR, array_merge( (array) $folder['path'], $name ) ); // Append the Extension to the file path $file .= '.php'; // Skip non-existent files if ( file_exists( $file ) ) { /** * A more Specific Filter that will include the template name * * @since 4.6.2 * @since 4.7.20 The $name param no longers contains the extension * * @param string $file Complete path to include the PHP File * @param array $name Template name * @param self $template Current instance of the Tribe__Template */ return apply_filters( 'tribe_template_file', $file, $name, $this ); } } // Couldn't find a template on the Stack return false; }
Changelog
Version | Description |
---|---|
4.7.20 | Introduced. |