WordPress filter using multiple categories

In my wordpress application I have parent category as
Places and Type and also subcategories as

Villa
Apartments
Plots under type and

Read More

USA
India
China under places.

When I am filter by places wordpress displays all posts under places (USA, India, China).

Now would like to add a refine search in my archieve listing page by subcategories like USA,India and China.
When select USA i would lik eto display posts under Places and USA. How can we apply multiple category filter in wordpress?

Related posts

Leave a Reply

1 comment

  1. It sounds like your site design calls for the user to click on, say, “USA”, which opens a page showing all Types, ie: “Villa, Apartments, and Plots”. Then the user would refine their listing preference by clicking on one of these last three to narrow their search.

    Each click requires a page reload and review of all the posts that match the filter. This is certainly an acceptable use model, and I recommend using template tags amd functions like get_categories, wp_list_categories, and get_category_parents to manually set-up your menu structure. Each of these functions has numerous query variables that allow you to tailor what you retrieve, including ‘child_of’, and ‘parent’.

    This manual method could be a many-line combination of the above functions, foreach loops, and if statements. Another method would be to use a category based navigation menu and javascript to hide sub-categories until the parent category is hovered. This has the advantage of less clicks to the narrowest sub-category available. Here’s a tutorial on this type of navigation: http://www.catswhocode.com/blog/wordpress-magazine-style-horizontal-dropdown-menu. It only goes one level deep, but I bet you could extend it to go two or three levels deep.

    I speculate that WP3.0’s new Menu functionality (Appearance->Menu’s) might be a third possible method. I have never worked with it directly, but on the face of it, this is exactly what custom menu’s are intended to provide. An easy interface to set up slightly complex menus.

    I’ve made some assumptions toward your vision for how this is executed. Maybe you could provide some further clarification and possibly psuedo code to guide any further answers that actually contain usable code (unlike this one).

    Good Luck.