Ticket #16539: 16539-6.patch
File 16539-6.patch, 2.2 KB (added by , 12 years ago) |
---|
-
wp-includes/general-template.php
151 151 * @return string|null String when retrieving, null when displaying or if searchform.php exists. 152 152 */ 153 153 function get_search_form( $echo = true, $format = 'xhtml' ) { 154 static $search_form_counter = 0; 155 154 156 do_action( 'get_search_form' ); 155 157 158 // Initialize the values 159 if ( 'html5' === $format ) { 160 $type = 'search'; 161 $placeholder = 'placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" '; 162 $form_id = ''; 163 $submit_id = ''; 164 } else { 165 $type = 'text'; 166 $placeholder = ''; 167 $form_id = $search_form_counter ? '' : ' id="searchform"'; 168 $submit_id = $search_form_counter ? '' : ' id="searchsubmit"'; 169 } 170 $text_id = $search_form_counter ? 's-' . $search_form_counter : 's'; 171 172 $search_form_counter++; 173 156 174 $search_form_template = locate_template( 'searchform.php' ); 157 175 if ( '' != $search_form_template ) { 158 176 ob_start(); 159 177 require( $search_form_template ); 160 178 $form = ob_get_clean(); 161 179 } else { 162 $type = ( 'html5' === $format ) ? 'search' : 'text'; 163 $placeholder = ( 'html5' === $format ) ? 'placeholder="' . esc_attr_x( 'Search …', 'placeholder' ) . '" ' : ''; 164 165 $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '"> 180 $form = '<form role="search" method="get"' . $form_id . ' class="searchform" action="' . esc_url( home_url( '/' ) ) . '"> 166 181 <div> 167 <label class="screen-reader-text" for=" s">' . _x( 'Search for:', 'label' ) . '</label>168 <input type="' . $type . '" ' . $placeholder . 'value="' . get_search_query() . '" name="s" id=" s" />169 <input type="submit" id="searchsubmit"value="'. esc_attr_x( 'Search', 'submit button' ) .'" />182 <label class="screen-reader-text" for="' . $text_id . '">' . _x( 'Search for:', 'label' ) . '</label> 183 <input type="' . $type . '" ' . $placeholder . 'value="' . get_search_query() . '" name="s" id="' . $text_id . '" /> 184 <input type="submit"' . $submit_id . ' value="'. esc_attr_x( 'Search', 'submit button' ) .'" /> 170 185 </div> 171 186 </form>'; 172 187 }