Show search query in search box and query in results page

Adding these snippets to your search template will display the search query on the results page and the search query within the search box on the results page.



<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
<input type="submit" id="searchsubmit" value="Search" />

<p>You searched for " <?php the_search_query() ?> ". Here are the results:</p>

Leave a comment