Searching and displaying results from ONLY one cat (2 posts)

  1. Anonymous
    Posted 11 years ago #

    hi yall. im having a problem doing this. here is the code i have as of now.
    <li id="search">
    <label for="s">Search:</label>
    <form id="searchform" method="get" action="/reviews.php">
    <input type="text" name="s" id="2" size="15" />
    <input type="submit" name="submit" value="Search" />
    <input type="hidden" name="cat" value="2" />
    i am trying to do a second page with wordpress and only show one catagory on it.
    I want to only search catagory 2 and its sub catagorys. As of now, i can search , but when i hit somethign that has a result, it bring me back to my main page showing posts from cat 1 which is not what i want.
    i want to NEVER show posts from anything but cat 2.
    any ideas?

  2. davidchait
    Posted 11 years ago #

    my guess is the search code ignores the category restriction thingy. you might want to look in wp-blog-header where the search string is processed/used, and maybe allow through category filtering.
    HOWEVER, if you want to do that, I'd suggest changing 'cat' to 'searchcat', and writing some new code to grab $searchcat from the post vars. That would be cleaner integration with stuff.
    Just off the top of my head...

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.