Ticket #13239: 13239.template.php.3.diff
File 13239.template.php.3.diff, 1.6 KB (added by , 9 years ago) |
---|
-
template.php
496 496 * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. 497 497 * @return string The template filename if one is located. 498 498 */ 499 function locate_template( $template_names, $load = false, $require_once = true ) {499 function locate_template( $template_names, $load = false, $require_once = true ) { 500 500 $located = ''; 501 501 foreach ( (array) $template_names as $template_name ) { 502 if ( ! $template_name )502 if ( ! $template_name ) { 503 503 continue; 504 if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { 504 } 505 if ( file_exists( STYLESHEETPATH . '/' . $template_name ) ) { 505 506 $located = STYLESHEETPATH . '/' . $template_name; 506 break; 507 } elseif ( file_exists(TEMPLATEPATH . '/' . $template_name) ) { 507 } elseif ( file_exists( TEMPLATEPATH . '/' . $template_name ) ) { 508 508 $located = TEMPLATEPATH . '/' . $template_name; 509 } 510 511 if ( '' != $located ) { 512 /** 513 * Filter the path of the template. 514 * 515 * @since 4.3.0 516 * 517 * @param string $located Path to the template. 518 * @param string|array $template_names Template file(s) to search for, in order. 519 */ 520 $located = apply_filters( 'locate_template', $located, $template_names ); 509 521 break; 510 522 } 511 523 } 512 524 513 if ( $load && '' != $located ) 525 if ( $load && '' != $located ) { 514 526 load_template( $located, $require_once ); 527 } 515 528 516 529 return $located; 517 530 } … … 557 570 require( $_template_file ); 558 571 } 559 572 } 560