Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to search in two categories without using the search box at all.

So far, I have this code to display the desired categories,

<?php wp_dropdown_categories('child_of=3&hierarchical=1&depth=1&hide_empty=0&name=cat[one]'); ?>
<?php wp_dropdown_categories('exclude=3&hierarchical=1&depth=1&hide_empty=0&name=cat[two]'); ?>

I have names as array cat as I wanted them to GET from URL and build custom query. I have tried many things but failed.

I just want the user to just press search and it should display posts that are in "Both" categories.

Please help. Thanks.

share|improve this question

1 Answer 1

Basically you don't really want search, but separate page that will list post on specific condition?

You can create template for a page with Loop that will query for posts, belonging to both categories, using category__and parameter.

share|improve this answer
    
ok, great suggestion, I did it and its what I needed. Thanks again. –  user2497 Jan 14 '11 at 13:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.