Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Preserve the search query in the search input when the user performs …

…a search.

This allows people to alter the text instead of retyping their query upon re-searching.
  • Loading branch information...
commit eca7244b50c39f7bda1b97994def9e79b066e7bc 1 parent 9a48ccf
@clarkbw clarkbw authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  templates/searchform.php
View
2  templates/searchform.php
@@ -1,5 +1,5 @@
<form role="search" method="get" id="searchform" class="form-search" action="<?php echo home_url('/'); ?>">
<label class="hide" for="s"><?php _e('Search for:', 'roots'); ?></label>
- <input type="text" value="" name="s" id="s" class="search-query" placeholder="<?php _e('Search', 'roots'); ?> <?php bloginfo('name'); ?>">
+ <input type="text" value="<?php if (is_search()) { echo get_search_query(); } ?>" name="s" id="s" class="search-query" placeholder="<?php _e('Search', 'roots'); ?> <?php bloginfo('name'); ?>">
<input type="submit" id="searchsubmit" value="<?php _e('Search', 'roots'); ?>" class="btn">
</form>
Please sign in to comment.
Something went wrong with that request. Please try again.