locate_template
locate_template ( $template_names, $load = false, $load_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) load_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: - Introduced in WordPress: 2.7.0
- Deprecated in WordPress: —
Description
Retrieves the name of the highest priority template file that exists.Searches in the stylesheet directory before the template directory and
wp-includes/theme-compat so that themes which inherit from a parent theme
can just overload one file.