Ticket #16539: 16539_searchform.3.diff
File 16539_searchform.3.diff, 9.8 KB (added by , 13 years ago) |
---|
-
wp-includes/general-template.php
149 149 * @param boolean $echo Default to echo and not return the form. 150 150 */ 151 151 function get_search_form($echo = true) { 152 static $search_form_counter = 0; 153 static $_first_search_form = true; 154 152 155 do_action( 'get_search_form' ); 153 156 157 // Initialize the id values 158 $form_id = 'searchform'; 159 $text_id = 's'; 160 $submit_id = 'searchsubmit'; 161 $first_search_form = $_first_search_form; 162 163 // If this is the first time the form has been displayed, flip the flag 164 // to false so the form id and submit id won't be displayed again 165 if ($_first_search_form) { 166 $_first_search_form = false; 167 } else { 168 // We still need the text counter, though 169 $text_id .= '-' . $search_form_counter; 170 } 171 172 // Incremement the counter 173 $search_form_counter++; 174 154 175 $search_form_template = locate_template('searchform.php'); 155 176 if ( '' != $search_form_template ) { 156 177 require($search_form_template); 157 178 return; 158 179 } 159 180 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') .'" />181 $form = '<form role="search" method="get"' . ($first_search_form ? 'id="' . $form_id . '"' : '') . ' class="searchform" action="' . home_url( '/' ) . '" > 182 <div><label class="screen-reader-text" for="' . $text_id . '">' . __('Search for:') . '</label> 183 <input type="text" class="searchinput field" value="' . get_search_query() . '" name="s" id="' . $text_id . '" /> 184 <input type="submit" class="searchsubmit submit" ' . ($first_search_form ? 'id="' . $submit_id . '"' : '') . ' value="'. esc_attr__('Search') .'" /> 164 185 </div> 165 186 </form>'; 166 187 -
wp-content/themes/twentyeleven/searchform.php
7 7 * @since Twenty Eleven 1.0 8 8 */ 9 9 ?> 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' ); ?>" />14 10 <form method="get" <?php if ($first_search_form) : ?>id="<?php echo $form_id; ?>"<? endif; ?> class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>"> 11 <label for="<?php echo $text_id; ?>" class="assistive-text"><?php _e( 'Search', 'twentyeleven' ); ?></label> 12 <input type="text" class="searchinput field" name="s" id="<?php echo $text_id; ?>" placeholder="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> 13 <input type="submit" class="searchsubmit submit" name="submit" <?php if ($first_search_form) : ?>id="<?php echo $submit_id; ?>"<?php endif; ?> value="<?php esc_attr_e( 'Search', 'twentyeleven' ); ?>" /> 14 </form> -
wp-content/themes/twentyeleven/style.css
278 278 width: auto; 279 279 } 280 280 /* Make sure the logo and search form don't collide */ 281 .one-column #branding #searchform { 281 .one-column #branding #searchform, 282 .one-column #branding .searchform { 282 283 right: 40px; 283 284 top: 4em; 284 285 } … … 453 454 input[type=text] { 454 455 padding: 3px; 455 456 } 456 input#s { 457 input#s, 458 input.searchinput { 457 459 background: url(images/search.png) no-repeat 5px 6px; 458 460 -moz-border-radius: 2px; 459 461 border-radius: 2px; … … 462 464 line-height: 1.2em; 463 465 padding: 4px 10px 4px 28px; 464 466 } 465 input#searchsubmit { 467 input#searchsubmit, 468 input.searchsubmit { 466 469 display: none; 467 470 } 468 471 … … 620 623 } 621 624 622 625 /* Search Form */ 623 #branding #searchform { 626 #branding #searchform, 627 #branding .searchform { 624 628 position: absolute; 625 629 top: 3.8em; 626 630 right: 7.6%; 627 631 text-align: right; 628 632 } 629 #branding #searchform div { 633 #branding #searchform div, 634 #branding .searchform div { 630 635 margin: 0; 631 636 } 632 #branding #s { 637 #branding #s, 638 #branding .searchinput { 633 639 float: right; 634 640 -webkit-transition-duration: 400ms; 635 641 -webkit-transition-property: width, background; … … 642 648 -o-transition-timing-function: ease; 643 649 width: 72px; 644 650 } 645 #branding #s:focus { 651 #branding #s:focus, 652 #branding .searchinput:focus { 646 653 background-color: #f9f9f9; 647 654 width: 196px; 648 655 } 649 #branding #searchsubmit { 656 #branding #searchsubmit, 657 #branding .searchsubmit { 650 658 display: none; 651 659 } 652 #branding .only-search #searchform { 660 #branding .only-search #searchform, 661 #branding .only-search .searchform { 653 662 top: 5px; 654 663 z-index: 1; 655 664 } 656 #branding .only-search #s { 665 #branding .only-search #s, 666 #branding .only-search .searchinput { 657 667 background-color: #666; 658 668 border-color: #000; 659 669 color: #222; 660 670 } 661 671 #branding .only-search #s, 662 #branding .only-search #s:focus { 672 #branding .only-search #s:focus, 673 #branding .only-search .searchinput, 674 #branding .only-search .searchinput:focus { 663 675 width: 85%; 664 676 } 665 #branding .only-search #s:focus { 677 #branding .only-search #s:focus, 678 #branding .only-search .searchinput:focus { 666 679 background-color: #bbb; 667 680 } 668 #branding .with-image #searchform { 681 #branding .with-image #searchform, 682 #branding .with-image .searchform { 669 683 top: auto; 670 684 bottom: -27px; 671 685 max-width: 195px; … … 787 801 border-top: 1px solid #ddd; 788 802 padding: 6px 10px 6px 0; 789 803 } 790 .entry-content #s { 804 .entry-content #s, 805 .entry-content .searchinput { 791 806 width: 75%; 792 807 } 793 808 .comment-content ul, … … 1277 1292 /* =error404 1278 1293 ----------------------------------------------- */ 1279 1294 1280 .error404 #main #searchform { 1295 .error404 #main #searchform, 1296 .error404 #main .searchform { 1281 1297 background: #f9f9f9; 1282 1298 border: 1px solid #ddd; 1283 1299 border-width: 1px 0; … … 1285 1301 overflow: hidden; 1286 1302 padding: 1.625em 8.9%; 1287 1303 } 1288 .error404 #main #s { 1304 .error404 #main #s, 1305 .error404 #main .searchinput { 1289 1306 width: 95%; 1290 1307 } 1291 1308 .error404 #main .widget { … … 1759 1776 .widget_search form { 1760 1777 margin: 0 0 1.625em; 1761 1778 } 1762 .widget_search #s { 1779 .widget_search #searchsubmit, 1780 .widget_search .searchinput { 1763 1781 width: 77%; 1764 1782 } 1765 .widget_search #searchsubmit { 1783 .widget_search #searchsubmit, 1784 .widget_search .searchsubmit { 1766 1785 background: #ddd; 1767 1786 border: 1px solid #ccc; 1768 1787 -webkit-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); … … 1774 1793 position: relative; 1775 1794 top: -2px; 1776 1795 } 1777 .widget_search #searchsubmit:active { 1796 .widget_search #searchsubmit:active, 1797 .widget_search .searchsubmit:active { 1778 1798 background: #1982d1; 1779 1799 border-color: #0861a5; 1780 1800 -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); … … 2399 2419 margin-right: 0; 2400 2420 } 2401 2421 /* Make sure the logo and search form don't collide */ 2402 #branding #searchform { 2422 #branding #searchform, 2423 #branding .searchform { 2403 2424 top: 1.625em !important; 2404 2425 } 2405 2426 /* Floated content doesn't work well at this size */ … … 2513 2534 #site-description { 2514 2535 font-size: 10pt; 2515 2536 } 2516 #branding #searchform { 2537 #branding #searchform, 2538 #branding .searchform { 2517 2539 display: none; 2518 2540 } 2519 2541 #branding img { -
wp-content/themes/twentyeleven/rtl.css
52 52 margin-right: 102px; 53 53 } 54 54 /* Make sure the logo and search form don't collide */ 55 .one-column #branding #searchform { 55 .one-column #branding form#searchform, 56 .one-column #branding form.searchform { 56 57 right: auto; 57 58 left: 40px; 58 59 } … … 99 100 padding-left: 0; 100 101 padding-right: 3px; 101 102 } 102 input#s { 103 input#s, 104 input.searchinput { 103 105 background-position: 97% 6px; 104 106 padding: 4px 28px 4px 10px; 105 107 } … … 147 149 } 148 150 149 151 /* Search Form */ 150 #branding #searchform { 152 #branding form#searchform, 153 #branding form.searchform { 151 154 right: auto; 152 155 left: 7.6%; 153 156 text-align: left; 154 157 } 155 #branding #s { 158 #branding #s, 159 #branding .searchinput { 156 160 float: left; 157 161 } 158 162 #branding .only-search + #access div { -
wp-content/themes/twentyeleven/colors/dark.css
42 42 input[type=text]:focus, 43 43 textarea:focus { 44 44 } 45 input#s { 45 input#s, 46 input.searchinput { 46 47 background-color: #ddd; 47 48 } 48 49 … … 67 68 #site-description { 68 69 color: #858585; 69 70 } 70 #branding #s { 71 #branding input#s, 72 #branding input.searchinput { 71 73 background-color: #ddd; 72 74 } 73 75 … … 253 255 254 256 /* =error404 255 257 ----------------------------------------------- */ 256 .error404 #main #searchform { 258 .error404 #main #searchform, 259 .error404 #main .searchform { 257 260 background: #060606; 258 261 border-color: #222; 259 262 } … … 406 409 } 407 410 408 411 /* Search Widget */ 409 .widget_search #searchsubmit { 412 .widget_search #searchsubmit, 413 .widget_search .searchsubmit { 410 414 background: #222; 411 415 border-color: #333; 412 416 -webkit-box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); … … 414 418 box-shadow: inset 0px -1px 1px rgba(0, 0, 0, 0.09); 415 419 color: #777; 416 420 } 417 .widget_search #searchsubmit:active { 421 .widget_search #searchsubmit:active, 422 .widget_search .searchsubmit:active { 418 423 -webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); 419 424 -moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1); 420 425 box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.1);