Home / search / Show search query in search box and query in results page
  • Show search query in search box and query in results page

    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.

    wordpress snippet : PHP - results in search box

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

    wordpress snippet : PHP - results query

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

    ( WordPress codex functions, hooks, in this snippet. )

    bloginfo, query,

Build a better with wpsnipp.com

Weekly snippets, themes, deals coupons roundup.

x No Thanks