• I have 2 custom menus. One is the main menu, and the other one is the sub-menu. When your using the main menu, wordpress applies the “current_page_item” class to make them look “active”. But I want to keep the current main link active while I’m in the sub-menu as well. Is there any way to add the sub-menu id:s to the matching parent or similar? Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • the backend works by using the classes ‘wp-has-submenu’ (to add the arrow) and ‘wp-has-current-submenu’ (so that the menu is displayed), so perhaps do a search on them and see what you can find. Sometimes peopel will have written about both front and back end, or you may even be able to use them on the front end.

    Thread Starter foo_bar

    (@foo_bar)

    Ok, well the thing is.. It’s not really a sub menu, according to wordpress. The main menu is one custom menu, as well as the sub menu. So I if i know how to get the parent ID from the database when i click a submenu, is there any way to apply the current_menu_item css style to the main mennu? Or can I still use the stuff you wrote? Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Keeping main menu links active while in sub-menu’ is closed to new replies.