Navigation bar to have different colored buttons when in a category
-
Ok I give up I need help!
What I’m trying to achieve is when a user is in a particular category the navigation bar will highlight the section they are in. I have managed to achieve this using the following code
<?php if (!is_page() && !is_home()){ $catsy = get_the_category(); $myCat = $catsy[0]->cat_ID; $currentcategory = '¤t_category='.$myCat; } wp_list_categories('orderby=name&title_li=&exclude=18,19,36¤t_category='.$currentcategory); ?>
The above code generates the horizontal menu and includes “current-cat” within the <li class=””> so I can control the active section button color with CSS.
BUT what I want to be able to do is have the active category button be a different color depending on which section they are within.
Example of what I’ve got so far
You will notice that currently it just stays blue, but I want it to be the color that corresponds with the header image.
The big question is how do I make the “current-cat” be a unique value so I can define it in the style sheet.
Or does someone know another way of doing this?
- The topic ‘Navigation bar to have different colored buttons when in a category’ is closed to new replies.