locate_template [ WordPress Function ]
locate_template ( $template_names, $load = false, $require_once = true )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Benzer Fonksiyonlar: load_template, get_date_template, get_template, get_category_template, is_page_template
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.
Source
<?php
function locate_template($template_names, $load = false, $require_once = true ) {
$located = '';
foreach ( (array) $template_names as $template_name ) {
if ( !$template_name )
continue;
if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
$located = STYLESHEETPATH . '/' . $template_name;
break;
} else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
$located = TEMPLATEPATH . '/' . $template_name;
break;
}
}
if ( $load && '' != $located )
load_template( $located, $require_once );
return $located;
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- Function Reference/locate template « WordPress Codex
Description. Retrieve the name of the highest priority template file that exists. Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which ...
codex.wordpress.org - WordPress › Support » Hook load_template or locate_template
May 18, 2012 ... Hook load_template or locate_template (1 post). Steveorevo Member Posted 12 hours ago #. This would excellent. Child development of ...
wordpress.org - 5 Ways To Include Template Files In WordPress - Deluxe Blog Tips
Jun 30, 2010 ... To check file existence, we can use locate_template() . This function allows us not only to retrieve file path, but also (optional) to include that file, ...
www.deluxeblogtips.com - plugins - locate_template with multiple categories? - WordPress
in this example (from Wrox book), if a single-category-$slug.php file exists, it will be shown, otherwise it's the single.php file. But if we have more than one ...
wordpress.stackexchange.com