Title: Help with Dynamic menu
Last modified: August 18, 2016

---

# Help with Dynamic menu

 *  [CoFOX](https://wordpress.org/support/users/coyotech/)
 * (@coyotech)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/help-with-dynamic-menu/)
 * I know I’m going to kick myself when i find out the simple mistake i made but
   i just don’t see it.
    The prob i have is I am try to get the menu to highlight
   base on category or posts in cats. It worked at first perfectly but for some 
   reason it just stopped working In my header
 *     ```
       <?php if ( is_home() ) { $current = 'front'; }
       elseif ( in_category(2) ) { $current = 'news'; }
       elseif ( in_category(4) ) { $current = 'sports'; }
       elseif ( in_category(5) ) { $current = 'comics'; }
       elseif ( in_category(9) ) { $current = 'features'; }
       elseif ( in_category(10) ) { $current = 'opinions'; }
       elseif ( in_category(6) ) { $current = 'arts'; }
       elseif ( is_page(51) ) { $current = 'archives'; }
       elseif ( is_page(23) ) { $current = 'about'; }
       elseif ( is_page(24) ) { $current = 'ads'; }
       elseif ( is_page(52) ) { $current = 'contact'; }
       elseif ( is_page(22) ) { $current = 'rss'; } ?>
   
       <style type="text/css">
       #<?php echo $current; ?> a{
        background:#bd4b01 url(http://thespectrum.freehostia.com/wp-content/themes/spectrum/images/<?php if (is_page()){echo 'checkh';}else {echo 'articlesh1';}?>.gif 6px 4px no-repeat;
       color:#fff;}
       </style>
   
       Then in the sidebar.php i have
       <ul class="sections">
       <li id="front"><a ...>Home</a></li>
       etc
       </ul>
       ```
   
 * Everything looks like it should work in the code but it just doesn’t
 * [http://www.thespectrum.freehostia.com](http://www.thespectrum.freehostia.com)

 The topic ‘Help with Dynamic menu’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [CoFOX](https://wordpress.org/support/users/coyotech/)
 * Last activity: [19 years, 7 months ago](https://wordpress.org/support/topic/help-with-dynamic-menu/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
