Skip to main content

benecaster_get_template_path()

Template Free
benecaster_get_template_path( string $template ): string

Returns the file benecaster_get_template_part() would load for a given part, checking child theme, then parent theme, then each registered add-on directory in registration order, then the plugin default. Where benecaster_locate_template() tells you whether the theme has taken over — and sees no add-on directories at all — this tells you which file is actually winning, wherever it came from.

Parameters

Name Type Default Required Description
$template string — Yes Relative path to the part, e.g. 'episode/title'.

Return Value

Type: string

The absolute path of the file that would actually be loaded, or an empty string when no file exists at any of the four locations.

Example

$path = benecaster_get_template_path( 'episode/title' );

Need this built rather than just documented? See our services →