I have the exact same request as danwillis: I want the parent category to be given a CSS class when a child category is selected.
There are many plugins to add a class to the active category, but none of them add anything to the parent. The closest I’ve come to a solution is Navigo, which does what I want, but with pages instead of categories.
If I click on a child category, Navigo adds “level1” to the ul containing the main links, “level1active” to the parent li, level2 to the child ul and “level2active” to the selected child category. I can style each level of the menu – it’s wonderful. Unfortunately it doesn’t work for categories… maybe someone can deconstruct the php?
Peter, I added your code to the functions.php and nothing happened. Does it need to be translated to work?