WordPress.org

Make WordPress Core

Ticket #14851: 14851.2.patch

File 14851.2.patch, 1.2 KB (added by WraithKenny, 13 months ago)
  • wp-includes/general-template.php

     
    146146 * search. To give a few examples of what it can be used for. 
    147147 * 
    148148 * @since 2.7.0 
    149  * @param boolean $echo Default to echo and not return the form. 
     149 * @param boolean|string $echo Default to echo and not return the form or if string returns the specialised searchform 
    150150 * @param string $format Which type to use for the search field. If set to 'html5' it changes to search input type and adds placeholder text. 
    151151 * @return string|null String when retrieving, null when displaying or if searchform.php exists. 
    152152 */ 
    153153function get_search_form( $echo = true, $format = 'xhtml' ) { 
    154154        do_action( 'get_search_form' ); 
    155155 
    156         $search_form_template = locate_template( 'searchform.php' ); 
     156        $templates = array(); 
     157        $name = $echo; 
     158        if ( is_string( $name ) ) { 
     159                $templates[] = "searchform-{$name}.php"; 
     160                $echo = false; 
     161        } 
     162        $templates[] = 'searchform.php'; 
     163        $search_form_template = locate_template( $templates ); 
    157164        if ( '' != $search_form_template ) { 
    158165                ob_start(); 
    159166                require( $search_form_template );