learner
learner

Reputation: 2129

wordpress custom search for post under selected category

Hi I want to create a custom post search under a particular category. How can I create that.

How to create a custom where condition related to that particular category?

Upvotes: 0

Views: 572

Answers (1)

maus
maus

Reputation: 182

You should try hijacking the search results (in search.php) if you have a certain query.

Meaning:

if a category (ID) is sent (perhaps as catID) by the search form together with the usual s variable, do a new query_posts('s=$s&paged...&cat=$catID');.

else just let the internal search take care of the results.

Upvotes: 1

Related Questions