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.
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.