• Resolved trixienolix

    (@trixienolix)


    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_c

    and another showing

    – issuesubcat_a
    – issuesubcat_b
    – issuesubcat_c

    Then 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

Viewing 1 replies (of 1 total)
  • Thread Starter trixienolix

    (@trixienolix)

    quick answer – i had to use a mix of categories and custom taxonomies (it’s not possible with categories alone). Then i made a taxonomy.php page with a simple loop.

    so my categories above became this:
    BLOG (5)
    – blogsubcat_a (6)
    – blogsubcat_b (7)
    – blogsubcat_c (8)
    ISSUES TAXONOMY
    issuetaxonomy_a
    issuetaxonomy_b
    issuetaxonomy_c

    To link to the pages I had to make a custom link in a menu and use a url that looked something like this:
    /?cat=7&issue=issuetaxonomy_c
    This then uses taxonomy.php automatically to show the posts with teh correct combination of category and taxonomy.

Viewing 1 replies (of 1 total)
  • The topic ‘Complex filter by category’ is closed to new replies.