wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
locate_template › WordPress Function
Seit2.7.0
Veraltetn/v
› locate_template ( $template_names, $load = false, $require_once = true, $args = array() )
Parameter: (4) |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: | |
Changelog: |
|
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.Ähnliche Funktionen: load_template, get_date_template, get_template, get_category_template, is_page_template
Quellcode
function locate_template( $template_names, $load = false, $require_once = true, $args = array() ) { $located = ''; foreach ( (array) $template_names as $template_name ) { if ( ! $template_name ) { continue; } if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) { $located = STYLESHEETPATH . '/' . $template_name; break; } elseif ( file_exists( TEMPLATEPATH . '/' . $template_name ) ) { $located = TEMPLATEPATH . '/' . $template_name; break; } elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) { $located = ABSPATH . WPINC . '/theme-compat/' . $template_name; break; } } if ( $load && '' !== $located ) { load_template( $located, $require_once, $args ); } return $located; }