Title: Dynamic Menu Highlighting Problem
Last modified: August 20, 2016

---

# Dynamic Menu Highlighting Problem

 *  Resolved [antonel1](https://wordpress.org/support/users/antonel1/)
 * (@antonel1)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/dynamic-menu-highlighting-problem/)
 * Hello,
 * I used the second method shown in [Dynamic Menu Highlighting](http://codex.wordpress.org/Dynamic_Menu_Highlighting)
   to have the navigation menu dynamically highlights the currently displayed page.
 * This is what I have in my header.php:
 *     ```
       <ul id="menu">
   
               <!-- To show "current" for Index -->
             <li<?php
                       if (is_home())
                       {
                       echo " id=\"current\"";
                       }?>>
                       <a href="<?php bloginfo('url') ?>">Everything</a>
   
               </li>
   
               <!-- To show "current" for Category -->
   
                <li<?php
                       if (is_category('Painting') || in_category('9') && !is_single())
                       {
                       echo " id=\"current\"";
                       }?>>
                       <a href="<?php bloginfo('url') ?>/category/painting">Painting</a>
               </li>
   
                <li<?php
                       if (is_category('Illustration') || in_category('32') && !is_single())
                       {
                       echo " id=\"current\"";
                       }?>>
                       <a href="<?php bloginfo('url') ?>/category/illustration">Illustration</a>
               </li>
   
                  <li<?php
                       if (is_category('Design') || in_category('25') && !is_single())
                       {
                       echo " id=\"current\"";
                       }?>>
                       <a href="<?php bloginfo('url') ?>/category/design">Design</a>
               </li>
   
                          <li<?php
                       if (is_category('Photography') || in_category('55') && !is_single())
                       {
                       echo " id=\"current\"";
                       }?>>
                       <a href="<?php bloginfo('url') ?>/category/photography">Photography</a>
               </li>
   
                       <li<?php
                       if (is_category('News') || in_category('51') && !is_single())
                       {
                       echo " id=\"current\"";
                       }?>>
                       <a href="<?php bloginfo('url') ?>/category/news">About</a>
               </li>
   
                <!-- To show "current" for Page -->
               <li<?php
                       if (is_page('Correspondance'))
                       {
                       echo " id=\"current\"";
                       }?>>
                       <a href="<?php bloginfo('url') ?>/correspondance">Correspondance</a>
               </li>
       </ul>
       ```
   
 * This is what I have is my css:
 *     ```
       #current a {
       	color: #5c9eb8;
       }
       ```
   
 * The result is that the navigation menu dynamically highlights the currently displayed
   page. All is working well except for a few issues.
 * When I click _Everything_ (which is the home page), it highlights _Everything_&
   _Illustration_. I’m only having this issue with home. Why is this happening?
 * And is there a way to highlight a category when visiting a post (single page)?
 * Thank you!
 * Antonella

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/dynamic-menu-highlighting-problem/#post-2906459)
 * try and change these sections:
 *     ```
       in_category('9') && !is_single()
       ```
   
 * to:
 *     ```
       in_category('9') && is_single()
       ```
   
 *  Thread Starter [antonel1](https://wordpress.org/support/users/antonel1/)
 * (@antonel1)
 * [13 years, 11 months ago](https://wordpress.org/support/topic/dynamic-menu-highlighting-problem/#post-2906463)
 * Alchymyth, you’ve just answered both of my questions. It’s works! You’re a genius.
   Thank you!!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Dynamic Menu Highlighting Problem’ is closed to new replies.

## Tags

 * [dynamic-menu-highlighting](https://wordpress.org/support/topic-tag/dynamic-menu-highlighting/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [antonel1](https://wordpress.org/support/users/antonel1/)
 * Last activity: [13 years, 11 months ago](https://wordpress.org/support/topic/dynamic-menu-highlighting-problem/#post-2906463)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
