Ticket #37443: 37443.patch
File 37443.patch, 2.3 KB (added by , 9 years ago) |
---|
-
wp-includes/template.php
510 510 * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. 511 511 * @return string The template filename if one is located. 512 512 */ 513 function locate_template( $template_names, $load = false, $require_once = true ) {513 function locate_template( $template_names, $load = false, $require_once = true ) { 514 514 $located = ''; 515 515 foreach ( (array) $template_names as $template_name ) { 516 if ( ! $template_name )516 if ( ! $template_name ) { 517 517 continue; 518 if ( file_exists(STYLESHEETPATH . '/' . $template_name)) { 519 $located = STYLESHEETPATH . '/' . $template_name; 518 } 519 520 /** 521 * Filters the path to the stylesheet directory used by load_template. 522 * 523 * Allows user to override STYLESHEETPATH. Useful in contexts where this 524 * context is not defined, such as oEmbed or Public API. 525 * 526 * @since 4.7.0 527 * 528 * @param string $template path to the stylesheet directory 529 */ 530 $stylesheet_path = apply_filters( 'stylesheet_path', STYLESHEETPATH ); 531 532 /** 533 * Filters the path to the template directory used by load_template. 534 * 535 * Allows user to override TEMPLATEPATH. Useful in contexts where this 536 * context is not defined, such as oEmbed or Public API. 537 * 538 * @since 4.7.0 539 * 540 * @param string $template path to the template directory 541 */ 542 $template_path = apply_filters( 'template_path', TEMPLATEPATH ); 543 544 if ( file_exists( $stylesheet_path . '/' . $template_name ) ) { 545 $located = $stylesheet_path . '/' . $template_name; 520 546 break; 521 } elseif ( file_exists( TEMPLATEPATH . '/' . $template_name) ) {522 $located = TEMPLATEPATH. '/' . $template_name;547 } elseif ( file_exists( $template_path . '/' . $template_name ) ) { 548 $located = $template_path . '/' . $template_name; 523 549 break; 524 550 } elseif ( file_exists( ABSPATH . WPINC . '/theme-compat/' . $template_name ) ) { 525 551 $located = ABSPATH . WPINC . '/theme-compat/' . $template_name; … … 527 553 } 528 554 } 529 555 530 if ( $load && '' != $located )556 if ( $load && '' !== $located ) { 531 557 load_template( $located, $require_once ); 558 } 532 559 533 560 return $located; 534 561 }