Merged in feature/81-dev-dev01 (pull request #5)
auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
@@ -684,8 +684,9 @@ function get_attachment_template() {
|
||||
/**
|
||||
* Retrieves 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.
|
||||
* 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.
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @since 5.5.0 The `$args` parameter was added.
|
||||
@@ -699,16 +700,20 @@ function get_attachment_template() {
|
||||
* @return string The template filename if one is located.
|
||||
*/
|
||||
function locate_template( $template_names, $load = false, $load_once = true, $args = array() ) {
|
||||
$stylesheet_path = get_stylesheet_directory();
|
||||
$template_path = get_template_directory();
|
||||
$is_child_theme = $stylesheet_path !== $template_path;
|
||||
|
||||
$located = '';
|
||||
foreach ( (array) $template_names as $template_name ) {
|
||||
if ( ! $template_name ) {
|
||||
continue;
|
||||
}
|
||||
if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) {
|
||||
$located = STYLESHEETPATH . '/' . $template_name;
|
||||
if ( file_exists( $stylesheet_path . '/' . $template_name ) ) {
|
||||
$located = $stylesheet_path . '/' . $template_name;
|
||||
break;
|
||||
} elseif ( file_exists( TEMPLATEPATH . '/' . $template_name ) ) {
|
||||
$located = TEMPLATEPATH . '/' . $template_name;
|
||||
} elseif ( $is_child_theme && file_exists( $template_path . '/' . $template_name ) ) {
|
||||
$located = $template_path . '/' . $template_name;
|
||||
break;
|
||||
} elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
|
||||
$located = ABSPATH . WPINC . '/theme-compat/' . $template_name;
|
||||
|
||||
Reference in New Issue
Block a user