Support » Themes and Templates » New menus & CSS selectors in 3.0 beta

  • Resolved Dalton Rooney


    I am trying to do something which seems like it should be simple with the new menu system in WordPress 3.0. I have a parent/child navigation scheme, kind of like this:

    Page 1
    Page 2
          *Subpage 1
          *Subpage 2

    When I’m on the home page, I only want the parent level navigation to show. If someone clicks on Page 2, though, then Subpage 1 and Subpage 2 will show up. Then, if they click through to Subpage 1, I still want to see the sibling pages in the navigation. (in this case, Subpage 2 should still be showing)

    Does this make sense so far?

    The problem I’m having is that the new wp_nav_menu function (I’m actually using the new widget in this case) does not offer enough classes to do this. I’ve got selectors for the parent menu <ul>, the sub-menu <ul>, and then the current-menu-item <li>. I need something like current-menu-parent for the parent <li> so I can keep all of the sibling pages visible if I’m on a sub-page.

    Here’s what I have so far if anyone can help out:

    Does anyone have more experience with this function, or am I going to have to use a different menu system? I would appreciate any help anyone can offer.

Viewing 2 replies - 1 through 2 (of 2 total)
  • If it helps at all, here is the CSS I am using for the current (not quite right) menu:

    ul.sub-menu li {
    	display: none;
    } li.current-menu-item ul.sub-menu li {
    	display: block;
    } ul.sub-menu li.current-menu-item {
    	display: block;

    Aha! This was patched in this Trac ticket:

    I applied the patch and the parent list item is selectable again. Phew!

    I hope this code makes it into the final release.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘New menus & CSS selectors in 3.0 beta’ is closed to new replies.