Allow string as first parameter to locate_template(). Props chrisbliss18 for initial patch. Fixes #15061
git-svn-id: http://svn.automattic.com/wordpress/trunk@15771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
47b8974ca6
commit
f0d8d094e2
|
@ -151,7 +151,7 @@ function get_template_part( $slug, $name = null ) {
|
||||||
function get_search_form($echo = true) {
|
function get_search_form($echo = true) {
|
||||||
do_action( 'get_search_form' );
|
do_action( 'get_search_form' );
|
||||||
|
|
||||||
$search_form_template = locate_template(array('searchform.php'));
|
$search_form_template = locate_template('searchform.php');
|
||||||
if ( '' != $search_form_template ) {
|
if ( '' != $search_form_template ) {
|
||||||
require($search_form_template);
|
require($search_form_template);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1075,17 +1075,14 @@ function get_comments_popup_template() {
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
*
|
*
|
||||||
* @param array $template_names Array of template files to search for in priority order.
|
* @param string|array $template_names Template file(s) to search for, in order.
|
||||||
* @param bool $load If true the template file will be loaded if it is found.
|
* @param bool $load If true the template file will be loaded if it is found.
|
||||||
* @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false.
|
* @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false.
|
||||||
* @return string The template filename if one is located.
|
* @return string The template filename if one is located.
|
||||||
*/
|
*/
|
||||||
function locate_template($template_names, $load = false, $require_once = true ) {
|
function locate_template($template_names, $load = false, $require_once = true ) {
|
||||||
if ( !is_array($template_names) )
|
|
||||||
return '';
|
|
||||||
|
|
||||||
$located = '';
|
$located = '';
|
||||||
foreach ( $template_names as $template_name ) {
|
foreach ( (array) $template_names as $template_name ) {
|
||||||
if ( !$template_name )
|
if ( !$template_name )
|
||||||
continue;
|
continue;
|
||||||
if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
|
if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
|
||||||
|
|
Loading…
Reference in New Issue