Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress custom menu action – newbie struggling Re: WordPress custom menu action – newbie struggling

#123651
Cyanoxide
Participant

Wordpresses’ wp_nav function needs a bit of CSS for drop downs to work which I’m assuming you already have implemented. You should have a piece of CSS like this:

ul.menu li.hover > ul.sub-menu{display:block;}

This code basically says to display the sub menu if the parent li is being hovered. If you are using the wp_nav function to call your menus you could probably get away with amending that line of code to something like this.

ul.menu li.current_page_item > ul.sub-menu{display:block};

It will display any sub-menus listed under the current page items list element. Not 100% there but it’s definitely a push in the right direction. Hope it helps.

___________________________

Upon doing a bit more research I found out that if you change “current_page_item” to “current_page_ancestor” it should also work when your on a page that is a child of that menu li.