tags:

views:

283

answers:

2

Hi,

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%5Fwordpress-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!

+1  A: 

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; }
Jon
A: 

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

roddik