Support » Plugins and Hacks » Hacks » Search on Page Slug

  • 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)
  • I am able to search within the tag group with this:

    <form method="get" id="search form" action="/">
    <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"/>

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

    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!


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


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