Your html structure should look like
<ul class="parent-class">
<li>Page 1</li>
<li>
<ul class="child-class">
<li> Sub menu item 1</li>
<li> Sub menu item 2</li>
</ul>
</li>
</ul>
WordPress should automatically add an “active” class to the active page then you should be able to style everything with css. Something like
.parent-class li ul {
Display:none;
}
.Active li ul {
display:block;
}
.parent-class:hover > .parent-class li ul {
display:block
}
Related Posts:
- Custom Nav Walker to show siblings and children of current branch?
- WordPress custom menu can’t show 3. level submenu
- WordPress menu walker – Get parent item text inside end_lvl function
- Menu items description? Custom Walker for wp_nav_menu()
- Add Caret to Menu Items with Sub-Menus in WordPress Theme
- Any walker causes blank menu?
- Extend walker – navigation, adding data attribute to a tag
- how to change WordPress menu markup/classes
- Custom Nav Walker Displaying Values in Sub Menu
- Find the Children of a Page then Echo it as a Bulleted List of Links (menu)
- Create wordpress header with custom logo in between the menu splitting the menu into two equal parts [closed]
- wp_post->post_parent object returning 0
- WordPress empty Nav Menu error
- Single-level menu option? Another way?
- Issue on Adding A Class to Bootstrap Navbar Walker Dropdown
- Custom Navigation build using wp_nav_menu and walker
- Admin: sub menu doesnt display under apperance when activate my themes
- Theme: dropdown hover menu not showing up in IE/Edge
- Show all menu levels except top level. How to exclude top level of a menu?
- WordPress doesn’t recognize submenus as so I can’t style them properly
- Horizontal Navigation
- Main Menu Theme Different Output Print
- Add wrapper for a specific sub-menu
- How to add posts to custom menus?
- wp_nav_menu(), how to change class?
- Display Menu Name using wp_nav_menu
- WordPress API Menu/Submenu Order
- How can I display a menu on certain pages only?
- Add custom classes to anchor in wp_nav_menu
- How to limit wordpress menu depth in admin panel
- Display only page specific sub menu items using Custom Walker
- Strict Standards Error bootstrap navwalker
- wp_nav_menu sort order?
- How to determine if custom menu is active?
- How do I check if a menu exists?
- How to use logout function on custom menu link?
- Add class to top level menu item if it has multiple child levels
- Simple Navigation Walker – Wrapper-class around first sub-menu
- How to display wp_nav_menu() conditionally only when not on a 404 page?
- How to add menu support to a theme?
- Problem with registering menus – What to do when other solutions aren’t working?
- Add a #hash to the links in my custom menu
- How can i change menu link when page content empty?
- Customize comment list markup
- Select menu on browser resize
- Custom Nav Walker sub-menu HTML construct
- Check if wp_nav_menu items have submenus
- How to add (css) classes to only one wp_nav_menu()?
- Get last modified date for menu link
- Replace Home with image link inside custom header menu
- Displaying wp menus by name without using theme locations
- Add div to specific sub-menu
- 3 Level Menu Navigation (3rd Level not displaying)
- How can I creat custom menu with bootstrap
- Use instead of for wp_nav_menu()
- Pages not displaying as sections on static page
- How can I show a custom WordPress menu anywhere I want on my website?
- Menu walker: how to tell if a sub menu contains submenus?
- Cold Fusion to WordPress
- Where to place a svg chevron down in my custom walker?
- Menu is in Reversed order
- WordPress Menu item > Sub menu Class update
- Menu names not getting translated
- Nav menus Fast previewing not working with wp_get_nav_menu_items!
- Displaying a part of a menu containing the page the user is currently viewing and only it’s immediate children
- How to know and change the machine name of a menu?
- Need help with adding custom wordpress menu and sub-menu
- How to achieve this navigation style in wordpress navigation
- HTML TO WP Theme : Submenu goes down wp_nav_menu
- wp_nav_menu custom walker class
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- Fallback dosen’t work when not using ‘menu’ attribute
- How to add custom nav_menu_css_class to certain menu only?
- Primary Menu Showing All Pages With No Sub-Nav
- Menu order of parent menu from perspective of child menu
- wp_nav_walker that interacts with widgets to setup mega menu
- How to add drop symbol to parent nav items which have child
- After theme change the menus have to be manually linked to the corresponding theme location
- child comments not displaying as nested
- How to add custom field option with menu?
- WordPress 3.9 two menus in same position?
- What’s the policy for building a theme that doesn’t support widgets/menus?
- Strict Standards Error bootstrap navwalker
- Problem with multiple menus in theme
- Menu item not created on theme activation
- How can I change the title of the Home link in the navigation bar?
- How do I move menu to the bottom in Custom Community theme?
- Header links also appearing in the footer
- Creating Multiple Menus in the Thesis Theme?
- How to make navigation a list without a plugin? [duplicate]
- How do I middle-align my header menu items in WordPress [closed]
- How to highlight current menu bar base on the URL?
- Global Navigation menu in diiferrent wordpress setups
- How to create sub-menu in “Allure Real Estate Theme for Placester”?
- How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?
- Dynamic nav menu with icons [closed]
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- wp_nav_menu_items callback not triggered
- Why is wp_nav_menu() not removing the container around the nav ?
- Custom loop menu is not working