WordPress.org

Ready to get started?Download WordPress

Forums

Test for Subcategories (2 posts)

  1. akanowicz
    Member
    Posted 7 years ago #

    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 (http://comox.textdrive.com/pipermail/wp-hackers/2006-June/006693.html)

    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: http://www.professional-astrology.org/members

    use: test1 and wordpress to see it.

  2. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    Have a look here:
    http://codex.wordpress.org/Category_Templates
    and make different templates for each category. You can call different header.php and sidebar.php from them.

Topic Closed

This topic has been closed to new replies.

About this Topic