WordPress.org

Make WordPress Core

Ticket #18302: 18302.2.2.patch

File 18302.2.2.patch, 1.5 KB (added by johnbillion, 3 years ago)
  • theme.php

     
    10601060} 
    10611061 
    10621062/** 
    1063  * Retrieve the name of the highest priority template file that exists. 
     1063 * Retrieve the full file path to the highest priority template file that exists. 
    10641064 * 
    10651065 * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which 
    10661066 * inherit from a parent theme can just overload one file. 
     
    10931093} 
    10941094 
    10951095/** 
     1096 * Retrieve the URI of the highest priority template file that exists. 
     1097 * 
     1098 * Searches in the stylesheet directory before the template directory so themes 
     1099 * which inherit from a parent theme can just overload one file. 
     1100 * 
     1101 * @since 3.3 
     1102 * 
     1103 * @param string|array $template_names Template file(s) to search for, in order. 
     1104 * @return string The URI of the file if one is located. 
     1105 */ 
     1106function locate_template_uri( $template_names ) { 
     1107        $located = ''; 
     1108        foreach ( (array) $template_names as $template_name ) { 
     1109                if ( !$template_name ) 
     1110                        continue; 
     1111                if ( file_exists(get_stylesheet_directory() . '/' . $template_name)) { 
     1112                        $located = get_stylesheet_directory_uri() . '/' . $template_name; 
     1113                        break; 
     1114                } else if ( file_exists(get_template_directory() . '/' . $template_name) ) { 
     1115                        $located = get_template_directory_uri() . '/' . $template_name; 
     1116                        break; 
     1117                } 
     1118        } 
     1119 
     1120        return $located; 
     1121} 
     1122 
     1123/** 
    10961124 * Require the template file with WordPress environment. 
    10971125 * 
    10981126 * The globals are set up for the template file to ensure that the WordPress