Codex

Function Reference/locate template

Contents

Description

Retrieve the name of the highest priority template file that exists.

Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which inherit from a parent theme can just overload one file.

Usage

<?php locate_template$template_names$load ?>

Parameters

$template_names
(array) (required) Array of template files to search for in priority order.
Default: None
$load
(boolean) (optional) If true the template file will be loaded if it is found.
Default: false

Return Values

(string) 
The template filename if one is located, an empty string if not.

Examples

Notes

Change Log

Since: 2.7.0

Source File

locate_template() is located in wp-includes/theme.php.

Related