wordpress snippets last updated   : January 29, 2015
we now have 646 snippets

Show search query in search box and query in results page

wordpress snippet

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.

snippet :  PHP - results in search boxcopy
<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" />
source →
snippet :  PHP - results querycopy
<p>You searched for " <?php the_search_query() ?> ". Here are the results:</p>
source →

Did you like this post? If so please share it with your friends. Thanks!