• I have tried the “Dynamic Menu Highlinghting” for my static pages and it works fine on my main menu. The problem is that I have another submenu that is generated dynamically. How do I get the “option selected” effect on the items of this second menu?

    I attach the code of my sidebar.php in case it helps:

    <div id="sub_nav">
        <?php
            if (is_page (array (2,4,6,8))) {
                        wp_list_pages('child_of=112&title_li=<h1>' . __('Services') . '</h1>' );    
    
            } elseif (is_page (array (1,3,5,7))) {
                wp_list_pages('child_of=70&title_li=<h1>' . __('Company') . '</h1>' );
    
            } else {
    ///Here it will come the sidebar info for the Blog (not ready yet)///
            }
        ?>
    </div>

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try styling on .current_page_item.

    Thread Starter gorkreg

    (@gorkreg)

    Thanks esmi. It doesn’t work though because the “current_page_item” class name is given to the father, not to each son. I explain myself: following my code, if I am in page “4”, that class name is for page “112”, not for page “4”.

    SERVICES <<< .current_page_item applies to this

    • Option 1
      Option 2
      Option 3 <<< Not to this one (that it’s what I want highlighted)
      Option 4
    • ¿Any other ideas?

    You can probably use the

    .current_page_parent { … } /* parent of the current Page */

    css selector to get the desired effect. See this page for more info.

    -Joe

    Thread Starter gorkreg

    (@gorkreg)

    Thanks jmsearcy! It looks like a great piece of information. I guess that after reading it I will be able to achieve what I want. I’ll get back to you with the answer.

    Thread Starter gorkreg

    (@gorkreg)

    In the end the problem wasn’t with the .current_page_item class name but with the CSS. I had a rule #sub_nav a { … } to change the default blue colour of the anchor to black. Trying to change it to red with the #sub_nav .current_page_item didn’t work because the class name applies to “li” not to “a”. Using #sub_nav .current_page_item a { … } it works fine.

    Thanks everyone for your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Dynamic Menu Highlighting on a dynamic menu’ is closed to new replies.