Support » Fixing WordPress » Test for Subcategories

  • I have two categories: Publications and Resources. Each of those has a few subcategories.

    In my category template I’d like to test to see which parent the list belongs to and then display the appropriate sidebar.

    If (subcategory of Publications) then display sidebar-pubs
    Else If (subcategory of Resources) then
    display sidebar-resources

    I found one post in the forum that pointed to this page (

    But I can’t make that work. I tried adding the code to the category.php file, I tried adding it to the functions.php and tried making it a plugin. But I get errors when trying to call it.

    Also, the main navigation uses tabs. If I’m on the main Resources page the tab shows as active. However, if I go to a subcategory of Resources the tab displays as inactive.

    Is there a way to test that the page displaying is indeed a subcat of Resources?

    Site is:

    use: test1 and wordpress to see it.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Test for Subcategories’ is closed to new replies.