Search form improvements:

- Add "searchform" class to form element, easier styling
- Better gettext for label, placeholder, and submit text, easier for translators
- Remove "name" attribute from submit button, not needed and it adds cruft to URL

See also http://core.trac.wordpress.org/ticket/15081
This commit is contained in:
Lance Willett 2013-02-27 14:49:26 -07:00
parent a1b163e8ea
commit 7ed3c58e23
1 changed files with 4 additions and 4 deletions

View File

@ -6,8 +6,8 @@
* @since _s 1.0 * @since _s 1.0
*/ */
?> ?>
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search"> <form method="get" id="searchform" class="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
<label for="s" class="assistive-text"><?php _e( 'Search', '_s' ); ?></label> <label for="s" class="assistive-text"><?php _ex( 'Search', 'assistive text', '_s' ); ?></label>
<input type="search" class="field" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" id="s" placeholder="<?php esc_attr_e( 'Search &hellip;', '_s' ); ?>" /> <input type="search" class="field" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" id="s" placeholder="<?php echo esc_attr_x( 'Search &hellip;', 'placeholder', '_s' ); ?>" />
<input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', '_s' ); ?>" /> <input type="submit" class="submit" id="searchsubmit" value="<?php echo esc_attr_x( 'Search', 'submit button', '_s' ); ?>" />
</form> </form>