Try styling on .current-cat-parent
Thx esmi! it work if you selected one of the child categorys. =)
But if i select a article i wont show in the .current state? Can I fix this?
I haven’t come across a workaround for this yet. Sorry 🙁
Thx anyway! But I am just saying that if I am reading a article that is in the category “example”. Then I want just that category to display in a active “class” state.
Know how to fix this?
The only solution I’ve found is by using inline styles.
You can dynnamically write out a block of style code to match the “cat-item-1”, “cat-item-2”, “cat-item-3” classes that WordPress creates.
<style>
<?php
foreach((get_the_category()) as $category) {
echo '.cat-item-'.$category->cat_ID . '{border:1px solid red} ';
} ?>
</style>
It only works visually if you’re using a strict category system where each post is a member of a single category at each category heirarchy level. Otherwise it displays like you’re ‘active’ at several places.
Did not get it to work.. But i have seen these over at http://www.tutorial9.net, that they have lighten up=(‘active’) the main category even if you are in a child category-post.
Well I imagine that they are using category templates to show the top level nav as active.
i.e. they’re aren’t using wp_list_categorys to generate the toplevel nav only the 2nd.