Reputation: 2020
I have a category structure like this in WordPress (that is echoed with wp _ list _ categories):
Works
Photos
1990-2000
Photo #1
Photo #2
Photo #3
2000-2010
Photo #1
Photo #2
Photo #3
Paintings
Watercolor
Painting #1
Painting #2
Oil paint
Painting #1
Painting #2
I want to highlight all parent categories while browsing the category child. For example: when I am on Works->Photos->1990-2000, I want all of the categories that I've gone through to appear bold.
I use the show active category plugin ( http://www.screenshine.net/blog/1474_wordpress-plugin-show-active-category ) to achive this when I am browsing a single post.
The paramenter current _ category ( http://codex.wordpress.org/Template_Tags/wp_list_categories#Parameters ) is something that I think can be usefull...
Thanks!
Upvotes: 0
Views: 1234
Reputation: 2322
By default WordPress sets the css class current-cat-parent to all the parent categories. So a css directive like:
li.current-cat-parent { font-weight: bold; color: red; }
should get you going.
Upvotes: 0
Reputation: 28362
What you want to do is called adding "bread crumps". This is a common task and there is a lot of plugins for that, you may give this one a try
Upvotes: 0
Reputation: 11273
I am assuming that your list is composed of ul and li elements. If this is the case, you could use some javascript to set the style of the parent elements.
element.parentNode will do the trick.
Javascript
element.parentNode.className = "highlighted";
CSS
.highlighted { font-weight: bold; }
Upvotes: 1