WordPress.org

Make WordPress Core

Changeset 15771


Ignore:
Timestamp:
10/10/10 22:10:36 (4 years ago)
Author:
scribu
Message:

Allow string as first parameter to locate_template(). Props chrisbliss18 for initial patch. Fixes #15061

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/general-template.php

    r15616 r15771  
    152152    do_action( 'get_search_form' ); 
    153153 
    154     $search_form_template = locate_template(array('searchform.php')); 
     154    $search_form_template = locate_template('searchform.php'); 
    155155    if ( '' != $search_form_template ) { 
    156156        require($search_form_template); 
  • trunk/wp-includes/theme.php

    r15739 r15771  
    10761076 * @since 2.7.0 
    10771077 * 
    1078  * @param array $template_names Array of template files to search for in priority order. 
     1078 * @param string|array $template_names Template file(s) to search for, in order. 
    10791079 * @param bool $load If true the template file will be loaded if it is found. 
    10801080 * @param bool $require_once Whether to require_once or require. Default true. Has no effect if $load is false. 
     
    10821082 */ 
    10831083function locate_template($template_names, $load = false, $require_once = true ) { 
    1084     if ( !is_array($template_names) ) 
    1085         return ''; 
    1086  
    10871084    $located = ''; 
    1088     foreach ( $template_names as $template_name ) { 
     1085    foreach ( (array) $template_names as $template_name ) { 
    10891086        if ( !$template_name ) 
    10901087            continue; 
Note: See TracChangeset for help on using the changeset viewer.