Dynamic Menus (archive categories) with current category highlighted
-
I’m trying to make a Dynamic Menu so that the current category is highlighted. I’ve found this code which I’ve tried to modify, but so far it’s not working correctly. Any help appreciated!
<ul id="nav_01"> <? if(is_category() || is_single()){ $category = end(get_the_category()); $current =$category->cat_ID; $current_name = $category->cat_name; } //echo $current_name . " has id ".$current; ?> <?php if (is_category($current)) { $highlight = "current"; } else {$highlight = ""; } ?> <li class="<?php echo $highlight; ?>"><a href="<?php echo get_settings('home'); ?>"><?php the_category('title_li='); ?></a></li> </ul>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Dynamic Menus (archive categories) with current category highlighted’ is closed to new replies.