Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding current search query to searchform.php #35

Merged
merged 1 commit into from

2 participants

@kovshenin
Owner

It may be useful to display what the user searched for in the search input, especially on pages like no-results.php where the search query is not displayed anywhere.

@kovshenin kovshenin Adding current search query to searchform.php
It may be useful to display what the user searched for in the search input, especially on pages like no-results.php where the search query is not displayed anywhere.
6fe882a
@ianstewart ianstewart merged commit 31c5a39 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 14, 2012
  1. @kovshenin

    Adding current search query to searchform.php

    kovshenin authored
    It may be useful to display what the user searched for in the search input, especially on pages like no-results.php where the search query is not displayed anywhere.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  searchform.php
View
2  searchform.php
@@ -8,6 +8,6 @@
?>
<form method="get" id="searchform" action="<?php echo esc_url( home_url( '/' ) ); ?>" role="search">
<label for="s" class="assistive-text"><?php _e( 'Search', '_s' ); ?></label>
- <input type="text" class="field" name="s" id="s" placeholder="<?php esc_attr_e( 'Search &hellip;', '_s' ); ?>" />
+ <input type="text" class="field" name="s" value="<?php echo esc_attr( get_search_query() ); ?>" id="s" placeholder="<?php esc_attr_e( 'Search &hellip;', '_s' ); ?>" />
<input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php esc_attr_e( 'Search', '_s' ); ?>" />
</form>
Something went wrong with that request. Please try again.