WordPress.org

Make WordPress Core

Ticket #15061: allow-string-locate_template-arg.diff

File allow-string-locate_template-arg.diff, 1.5 KB (added by chrisbliss18, 4 years ago)
  • wp-includes/general-template.php

    diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php
    index 3962bc9..1ffd71b 100644
    a b function get_template_part( $slug, $name = null ) { 
    151151function get_search_form($echo = true) { 
    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); 
    157157                return; 
  • wp-includes/theme.php

    diff --git a/wp-includes/theme.php b/wp-includes/theme.php
    index 3d67806..ef86c80 100644
    a b function get_comments_popup_template() { 
    10751075 * 
    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 to search for, or an array thereof in priority 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. 
    10811081 * @return string The template filename if one is located. 
    10821082 */ 
    10831083function locate_template($template_names, $load = false, $require_once = true ) { 
    1084         if ( !is_array($template_names) ) 
     1084        if ( is_string($template_names) ) 
     1085                $template_names = array($template_names); 
     1086        else if ( !is_array($template_names) ) 
    10851087                return ''; 
    10861088 
    10871089        $located = '';