Make WordPress Core

Ticket #16539: 16539_searchform.diff

File 16539_searchform.diff, 8.9 KB (added by kurtpayne, 14 years ago)
  • wp-content/themes/twentyeleven/rtl.css

     
    5252        margin-right: 102px;
    5353}
    5454/* Make sure the logo and search form don't collide */
    55 .one-column #branding #searchform {
     55.one-column #branding form.searchform {
    5656        right: auto;
    5757        left: 40px;
    5858}
     
    9999        padding-left: 0;
    100100        padding-right: 3px;
    101101}
    102 input#s {
     102input.searchinput {
    103103        background-position: 97% 6px;
    104104        padding: 4px 28px 4px 10px;
    105105}
     
    147147}
    148148
    149149/* Search Form */
    150 #branding #searchform {
     150#branding form.searchform {
    151151        right: auto;
    152152        left: 7.6%;
    153153        text-align: left;
    154154}
    155 #branding #s {
     155#branding .searchinput {
    156156        float: left;
    157157}
    158158#branding .only-search + #access div {
  • wp-content/themes/twentyeleven/searchform.php

     
    77 * @since Twenty Eleven 1.0
    88 */
    99?>
    10         <form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    11                 <label for="s" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label>
    12                 <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
    13                 <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
     10        <?php
     11                if (!isset($GLOBALS['search_form_counter']))
     12                        $GLOBALS['search_form_counter'] = 1;
     13                $id = $GLOBALS['search_form_counter'];
     14        ?>
     15        <form method="get" id="searchform-<?php echo $id; ?>" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>">
     16                <label for="s-<?php echo $id; ?>" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label>
     17                <input type="text" class="searchinput field" name="s" id="s-<?php echo $id; ?>" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
     18                <input type="submit" class="searchsubmit submit" name="submit" id="searchsubmit-<?php echo $id; ?>" value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" />
    1419        </form>
     20        <? $GLOBALS['search_form_counter']++; ?>
     21 No newline at end of file
  • wp-content/themes/twentyeleven/style.css

     
    278278        width: auto;
    279279}
    280280/* Make sure the logo and search form don't collide */
    281 .one-column #branding #searchform {
     281.one-column #branding .searchform {
    282282        right: 40px;
    283283        top: 4em;
    284284}
     
    453453input[type=text] {
    454454        padding: 3px;
    455455}
    456 input#s {
     456input.searchinput {
    457457        background: url(images/search.png) no-repeat 5px 6px;
    458458        -moz-border-radius: 2px;
    459459        border-radius: 2px;
     
    462462        line-height: 1.2em;
    463463        padding: 4px 10px 4px 28px;
    464464}
    465 input#searchsubmit {
     465input.searchsubmit {
    466466        display: none;
    467467}
    468468
     
    620620}
    621621
    622622/* Search Form */
    623 #branding #searchform {
     623#branding .searchform {
    624624        position: absolute;
    625625        top: 3.8em;
    626626        right: 7.6%;
    627627        text-align: right;
    628628}
    629 #branding #searchform div {
     629#branding .searchform div {
    630630        margin: 0;
    631631}
    632 #branding #s {
     632#branding .searchinput {
    633633        float: right;
    634634        -webkit-transition-duration: 400ms;
    635635        -webkit-transition-property: width, background;
     
    642642        -o-transition-timing-function: ease;
    643643        width: 72px;
    644644}
    645 #branding #s:focus {
     645#branding .searchinput:focus {
    646646        background-color: #f9f9f9;
    647647        width: 196px;
    648648}
    649 #branding #searchsubmit {
     649#branding .searchsubmit {
    650650        display: none;
    651651}
    652 #branding .only-search #searchform {
     652#branding .only-search .searchform {
    653653        top: 5px;
    654654        z-index: 1;
    655655}
    656 #branding .only-search #s {
     656#branding .only-search .searchinput {
    657657        background-color: #666;
    658658        border-color: #000;
    659659        color: #222;
    660660}
    661 #branding .only-search #s,
    662 #branding .only-search #s:focus {
     661#branding .only-search .searchinput,
     662#branding .only-search .searchinput:focus {
    663663        width: 85%;
    664664}
    665 #branding .only-search #s:focus {
     665#branding .only-search .searchinput:focus {
    666666        background-color: #bbb;
    667667}
    668 #branding .with-image #searchform {
     668#branding .with-image .searchform {
    669669        top: auto;
    670670        bottom: -27px;
    671671}
     
    786786        border-top: 1px solid #ddd;
    787787        padding: 6px 10px 6px 0;
    788788}
    789 .entry-content #s {
     789.entry-content .searchinput {
    790790        width: 75%;
    791791}
    792792.comment-content ul,
     
    12761276/* =error404
    12771277----------------------------------------------- */
    12781278
    1279 .error404 #main #searchform {
     1279.error404 #main .searchform {
    12801280        background: #f9f9f9;
    12811281        border: 1px solid #ddd;
    12821282        border-width: 1px 0;
     
    12841284        overflow: hidden;
    12851285        padding: 1.625em 8.9%;
    12861286}
    1287 .error404 #main #s {
     1287.error404 #main .searchinput {
    12881288        width: 95%;
    12891289}
    12901290.error404 #main .widget {
     
    17581758.widget_search form {
    17591759        margin: 0 0 1.625em;
    17601760}
    1761 .widget_search #s {
     1761.widget_search .searchinput {
    17621762        width: 77%;
    17631763}
    1764 .widget_search #searchsubmit {
     1764.widget_search .searchsubmit {
    17651765        background: #ddd;
    17661766        border: 1px solid #ccc;
    17671767        -webkit-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09);
     
    17731773        position: relative;
    17741774        top: -2px;
    17751775}
    1776 .widget_search #searchsubmit:active {
     1776.widget_search .searchsubmit:active {
    17771777        background: #1982d1;
    17781778        border-color: #0861a5;
    17791779        -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1);
     
    23982398                margin-right: 0;
    23992399        }
    24002400        /* Make sure the logo and search form don't collide */
    2401         #branding #searchform {
     2401        #branding .searchform {
    24022402                top: 1.625em !important;
    24032403        }
    24042404        /* Floated content doesn't work well at this size */
     
    25122512        #site-description {
    25132513                font-size: 10pt;
    25142514        }
    2515         #branding #searchform {
     2515        #branding .searchform {
    25162516                display: none;
    25172517        }
    25182518        #branding img {
  • wp-content/themes/twentyeleven/colors/dark.css

     
    4242input[type=text]:focus,
    4343textarea:focus {
    4444}
    45 input#s {
     45input.searchinput {
    4646        background-color: #ddd;
    4747}
    4848
     
    6767#site-description {
    6868        color: #858585;
    6969}
    70 #branding #s {
     70#branding input.searchinput {
    7171        background-color: #ddd;
    7272}
    7373
     
    253253
    254254/* =error404
    255255----------------------------------------------- */
    256 .error404 #main #searchform {
     256.error404 #main .searchform {
    257257        background: #060606;
    258258        border-color: #222;
    259259}
     
    406406}
    407407
    408408/* Search Widget */
    409 .widget_search #searchsubmit {
     409.widget_search .searchsubmit {
    410410        background: #222;
    411411        border-color: #333;
    412412        -webkit-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09);
     
    414414        box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09);
    415415        color: #777;
    416416}
    417 .widget_search #searchsubmit:active {
     417.widget_search .searchsubmit:active {
    418418        -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1);
    419419        -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1);
    420420        box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1);
     
    538538#respond .comment-form-email .required {
    539539        color: #42caff;
    540540}
    541 #respond input#submit {
     541#respond #submit {
    542542        background: #ddd;
    543543        -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
    544544        -moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
  • wp-includes/general-template.php

     
    149149 * @param boolean $echo Default to echo and not return the form.
    150150 */
    151151function get_search_form($echo = true) {
     152        global $search_form_counter;
     153        if (!isset($search_form_counter))
     154                $search_form_counter = 1;
    152155        do_action( 'get_search_form' );
    153156
    154157        $search_form_template = locate_template('searchform.php');
     
    157160                return;
    158161        }
    159162
    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') .'" />
     163        $form = '<form role="search" method="get" id="searchform-' . $search_form_counter . '" class="searchform" action="' . home_url( '/' ) . '" >
     164        <div><label class="screen-reader-text" for="s-' . $search_form_counter . '">' . __('Search for:') . '</label>
     165        <input type="text" class="searchinput field" value="' . get_search_query() . '" name="s" id="s-' . $search_form_counter . '" />
     166        <input type="submit" class="searchsubmit submit" id="searchsubmit-' . $search_form_counter . '" value="'. esc_attr__('Search') .'" />
    164167        </div>
    165168        </form>';
     169        $search_form_counter++;
    166170
    167171        if ( $echo )
    168172                echo apply_filters('get_search_form', $form);