• Hello,

    How can I have a search form that queries only post that has a tag that matches the current page’s page slug?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter dadvan

    (@dadvan)

    I am able to search within the tag group with this:

    <form method="get" id="search form" action="/">
    <div>
    <input type="text" value="" name="s" id="s" />
    <input type="hidden" value="consulting" name="tag" id="post_tag" />
    <input type="submit" id="search_submit" name="Search" value="Search"/>
    </div>
    </form>

    How can I pull in the page slug as the value in the hidden field?

    Thread Starter dadvan

    (@dadvan)

    OK, So i inputted this in the value and now it will search in a tag that matches the page slug:

    <?php echo $post->post_name; ?>

    Hope this helps someone!

    Hiya,

    I’m also trying to create a search form that finds and highlights the results by only looking at the current page.

    thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Search on Page Slug’ is closed to new replies.