Try targeting the following CSS classes:
.current_page_ancestor,
.current_page_parent {
/* CSS styles go here */
}
The .current-menu-ancestor
and .current-menu-parent
classes only get applied if wp_nav_menu() (i.e. a custom menu) is used to output the menu. If the fallback menu is used (i.e. wp_list_pages()), then these classes won’t get applied.
However, the .current_page_ancestor
and .current_page_parent
classes are applied for both wp_nav_menu()
output and for wp_list_pages()
output.
(I’ll bring this up with Ian Stewart; I just noticed that he’s targeting the menu classes, rather than the page classes, in styling the TwentyTen nav menu.)
Hi there Chip, thanks for the reply!
The code you suggested didn’t exist in my stylesheet so I created it- i.e
#access ul li.current_page_parent a {
background: red;
}
The problem with this is that all of the items in the dropdown are affected. 1st, 2nd and third menu items for the particular menu tab.
Do you know how I can make it affect only the first level? π
You need to reset the background color for nested lists. For example:
#access ul li.current_page_parent ul a {
background: black; /* Use whatever your default background color is */
}
Resetting the background colour worked, unfortunately we’re back to a situation where a level three selection themes the second level menu item, and not the first :/
I used the code that you offered above…
Should I paste my menu section in here?