Complex filter by category
-
i’m building a complex site that requires many cross-linking categories. I am a bit stuck with how to build the following scenario:
Let’s say I have these categories and subcategories (ids in brackets):
BLOG (5)
– blogsubcat_a (6)
– blogsubcat_b (7)
– blogsubcat_c (8)
ISSUES(10)
– issuesubcat_a (11)
– issuesubcat_b (12)
– issuesubcat_c (13)I then have blog posts that belong to both parent categories and then a subcategory from each main category: e.g. a post belongs to catid 5,7,10,13
When on the blog page (category-5.php) I need to be able to filter all blog posts by these other categories. So on the sidebar i have 2 lists, one showing:
– blogsubcat_a
– blogsubcat_b
– blogsubcat_cand another showing
– issuesubcat_a
– issuesubcat_b
– issuesubcat_cThen when I click on those links I need to go to a page that shows me blog posts (id 5) that also belong in the relevant subcategory.
So i’m filtering the blog by subcategories.
My questions are:
1) What code do I use to show these 2 lists?
2) What code do i use to show the posts that satisfy the relevant crossover of categories e.g. 5&7&12
3) How do I test for the relevant categories e.g. using conditional statements… so i can say “if user clicked on issuesubcat_b then show posts that belong to category 5&12
(i’m confused as to whether this is possible using category.php)Thanks in advance
- The topic ‘Complex filter by category’ is closed to new replies.