[resolved] New menus & CSS selectors in 3.0 beta (3 posts)

  1. Dalton Rooney
    Posted 5 years ago #

    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: http://nk.daltonrooney.com

    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.

  2. Dalton Rooney
    Posted 5 years ago #

    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;
    ul.menu li.current-menu-item ul.sub-menu li {
    	display: block;
    ul.menu ul.sub-menu li.current-menu-item {
    	display: block;
  3. Dalton Rooney
    Posted 5 years ago #

    Aha! This was patched in this Trac ticket: http://core.trac.wordpress.org/ticket/12812

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

    I hope this code makes it into the final release.

Topic Closed

This topic has been closed to new replies.

About this Topic