Ticket #13239: 13239.2.diff
File 13239.2.diff, 1.6 KB (added by , 11 years ago) |
---|
-
wp-includes/template.php
359 359 * inherit from a parent theme can just overload one file. 360 360 * 361 361 * @since 2.7.0 362 * @uses apply_filters() Calls 'locate_template' filter on array of template names. 362 363 * 363 364 * @param string|array $template_names Template file(s) to search for, in order. 364 365 * @param bool $load If true the template file will be loaded if it is found. … … 366 367 * @return string The template filename if one is located. 367 368 */ 368 369 function locate_template($template_names, $load = false, $require_once = true ) { 370 $template_names = apply_filters( 'locate_template', $template_names, $load, $require_once ); 371 369 372 $located = ''; 370 373 foreach ( (array) $template_names as $template_name ) { 371 374 if ( !$template_name ) 372 375 continue; 373 if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {374 $located = STYLESHEETPATH . '/' .$template_name;376 if ( path_is_absolute( $template_name ) && file_exists( $template_name ) ) { 377 $located = $template_name; 375 378 break; 376 } else if ( file_exists( TEMPLATEPATH . '/' . $template_name)) {377 $located = TEMPLATEPATH. '/' . $template_name;379 } else if ( file_exists( get_stylesheet_directory() . '/' . $template_name)) { 380 $located = get_stylesheet_directory() . '/' . $template_name; 378 381 break; 382 } else if ( file_exists( get_template_directory() . '/' . $template_name) ) { 383 $located = get_template_directory() . '/' . $template_name; 384 break; 379 385 } 380 386 } 381 387