Make WordPress Core

Ticket #16539: 16539.10.diff

File 16539.10.diff, 3.1 KB (added by bpetty, 12 years ago)
  • wp-includes/general-template.php

    diff --git wp-includes/general-template.php wp-includes/general-template.php
    index 5598f9c..72a4898 100644
    function get_template_part( $slug, $name = null ) { 
    153153 * @return string|null String when retrieving, null when displaying or if searchform.php exists.
    154154 */
    155155function get_search_form( $echo = true ) {
    156         static $search_form_counter = 0;
    157 
    158156        do_action( 'pre_get_search_form' );
    159157
    160158        $format = apply_filters( 'search_form_format', 'xhtml' );
    161159
    162         // Initialize the values
    163         $form_id   = $search_form_counter ? '' : ' id="searchform"';
    164         $submit_id = $search_form_counter ? '' : ' id="searchsubmit"';
    165         $text_id   = $search_form_counter ? 's-' . $search_form_counter : 's';
    166 
    167160        $search_form_template = locate_template( 'searchform.php' );
    168161        if ( '' != $search_form_template ) {
    169162                ob_start();
    function get_search_form( $echo = true ) { 
    171164                $form = ob_get_clean();
    172165        } else {
    173166                if ( 'html5' == $format ) {
    174                         $form = '<form role="search" method="get" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
    175                                 <div>
    176                                         <label><span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
    177                                                 <input type="search" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" title="' . _x( 'Search for:', 'label' ) . '" />
    178                                         </label>
    179                                         <input type="submit" class="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
    180                                 </div>
    181                         </form>';
    182                 } else {
    183                         $form = '<form role="search" method="get"' . $form_id . ' class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
    184                                 <div>
    185                                         <label class="screen-reader-text" for="' . $text_id . '">' . _x( 'Search for:', 'label' ) . '</label>
    186                                         <input type="text" value="' . get_search_query() . '" name="s" id="' . $text_id . '" />
    187                                         <input type="submit"' . $submit_id . ' value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
    188                                 </div>
     167                        $form = '<form role="search" method="get" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
     168                                <label><span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
     169                                        <input type="search" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" title="' . _x( 'Search for:', 'label' ) . '" />
     170                                </label>
     171                                <input type="submit" class="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
     172                        </form>';
     173                } else {
     174                        $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
     175                                <div>
     176                                        <label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
     177                                        <input type="text" value="' . get_search_query() . '" name="s" id="s" />
     178                                        <input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
     179                                </div>
    189180                        </form>';
    190181                }
    191182        }
    function get_search_form( $echo = true ) { 
    194185        if ( null === $result )
    195186                $result = $form;
    196187
    197         $search_form_counter++;
    198 
    199188        if ( $echo )
    200189                echo $result;
    201190        else