locate_template


locate_template ( $template_names, $load = false, $require_once = true, $args = array() )

Parameters:
  • (string|array) template_names Template file(s) to search for, in order.
  • (bool) load If true the template file will be loaded if it is found.
  • (bool) require_once Whether to require_once or require. Has no effect if `$load` is false. Default true.
  • (array) args Optional. Additional arguments passed to the template. Default empty array.
Returns:
  • (string) The template filename if one is located.
Defined at:
Change Log:
  • 5: .

Description

Retrieve the name of the highest priority template file that exists.Searches in the STYLESHEETPATH before TEMPLATEPATH and wp-includes/theme-compat so that themes which inherit from a parent theme can just overload one file.

Related Functions

load_template, get_date_template, get_template, get_category_template, is_page_template

Top Google Results

User discussions

wpseek mobile