Changeset 56635 for trunk/src/wp-includes/template.php
- Timestamp:
- 09/20/2023 05:25:26 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/template.php
r56357 r56635 685 685 * Retrieves the name of the highest priority template file that exists. 686 686 * 687 * Searches in the STYLESHEETPATH before TEMPLATEPATH and wp-includes/theme-compat 688 * so that themes which inherit from a parent theme can just overload one file. 687 * Searches in the stylesheet directory before the template directory and 688 * wp-includes/theme-compat so that themes which inherit from a parent theme 689 * can just overload one file. 689 690 * 690 691 * @since 2.7.0 … … 700 701 */ 701 702 function locate_template( $template_names, $load = false, $load_once = true, $args = array() ) { 703 $stylesheet_path = get_stylesheet_directory(); 704 $template_path = get_template_directory(); 705 $is_child_theme = $stylesheet_path !== $template_path; 706 702 707 $located = ''; 703 708 foreach ( (array) $template_names as $template_name ) { … … 705 710 continue; 706 711 } 707 if ( file_exists( STYLESHEETPATH. '/' . $template_name ) ) {708 $located = STYLESHEETPATH. '/' . $template_name;712 if ( file_exists( $stylesheet_path . '/' . $template_name ) ) { 713 $located = $stylesheet_path . '/' . $template_name; 709 714 break; 710 } elseif ( is_child_theme() && file_exists( TEMPLATEPATH. '/' . $template_name ) ) {711 $located = TEMPLATEPATH. '/' . $template_name;715 } elseif ( $is_child_theme && file_exists( $template_path . '/' . $template_name ) ) { 716 $located = $template_path . '/' . $template_name; 712 717 break; 713 718 } elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) {
Note: See TracChangeset
for help on using the changeset viewer.