Ticket #14851: 14851.patch
File 14851.patch, 1.9 KB (added by , 14 years ago) |
---|
-
wp-includes/general-template.php
146 146 * search. To give a few examples of what it can be used for. 147 147 * 148 148 * @since 2.7.0 149 * @param boolean $echo Default to echo and not return the form. 149 * @uses do_action() Calls 'get_search_form' action. 150 * 151 * @param string $name The name of the specialised search form. 150 152 */ 151 function get_search_form( $echo = true) {152 do_action( 'get_search_form' );153 function get_search_form( $name = null) { 154 do_action( 'get_search_form', $name ); 153 155 154 $search_form_template = locate_template('searchform.php'); 155 if ( '' != $search_form_template ) { 156 require($search_form_template); 157 return; 158 } 156 $templates = array(); 157 if ( isset($name) ) 158 $templates[] = "searchform-{$name}.php"; 159 159 160 $form = '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" > 161 <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label> 162 <input type="text" value="' . get_search_query() . '" name="s" id="s" /> 163 <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" /> 164 </div> 165 </form>'; 160 $templates[] = "searchform.php"; 166 161 167 if ( $echo ) 168 echo apply_filters('get_search_form', $form); 169 else 170 return apply_filters('get_search_form', $form); 162 // if file doesn't exist, the default search form will be displayed 163 if ('' == locate_template($templates, true)) 164 echo '<form role="search" method="get" id="searchform" action="' . home_url( '/' ) . '" > 165 <div><label class="screen-reader-text" for="s">' . __('Search for:') . '</label> 166 <input type="text" value="' . get_search_query() . '" name="s" id="s" /> 167 <input type="submit" id="searchsubmit" value="'. esc_attr__('Search') .'" /> 168 </div> 169 </form>'; 171 170 } 172 171 173 172 /**