Figured it out! Use the following PHP code.
/*
* Toggles the menu dropdowns to open state
*/
function mod_toggle_menus() {
?>
<script type="text/javascript">
jQuery(document).ready( function() {
/* add toggled-on class to submenus */
jQuery('.sub-menu').addClass('toggled-on');
});
</script>
<?php
}
add_action('wp_footer' , 'mod_toggle_menus');
Related Posts:
- getting the current sub item out of total sub items in a given dropdown (custom walker)
- Dropdown primary navigation menu not working
- Is there any way to change the CSS class applied to 2nd level sub menu ul’s?
- Should I custom code drop down menus or use a wordpress plugin?
- What is the best way to incorporate responsive dropdown navigation menu into custom theme?
- Add custom menu item using wp_nav_menu_items filter
- how to create a menu with all sub categories?
- Add separator to admin submenu
- Add a .last class to the last in each ul.sub-menu
- Multi Level Bootstrap Navigation Menu in WordPress
- How show sub menu only using wp_nav_menu()
- Bootstrap dropdown nav pills not working with wp_nav_menu()
- Show only 2nd level of navigation depending on active navigation
- Show child pages by menu order using Superfish Dropdown menu?
- Bootstrap drop down menu with wp_nav_menu
- wp_nav_menu() loses ‘current-menu-*’ classes on single product page within category
- How to make pages metabox display all hierarchy in menu admin?
- Add items to a menu dynamically
- How can I add a sub menu to an existing navigation menu in WordPress?
- Custom Nav Walker sub-menu HTML construct
- Add div to specific sub-menu
- Adding different classes to anchor in navigation menu
- Custom Walker for Walker_Nav_Menu
- Arrow down in menu not displaying
- Handling complex multi-level architecture / menu for large site
- Update Nav Menu Items Programmatically
- How to display dynamic content in start_lvl function
- Menus like a CMS
- next_post_link() on custom menu structure
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- Does loading of sub pages in menu cause load to the server?
- Show menu based on parent & ancestor
- How to include a third level with wp_get_nav_menu_items function
- wp_nav_menu() with multiple Class
- Schedule Page to Menu [duplicate]
- Update body class based on menu
- Trying to Create Menu in WordPress
- Hierarchical menu nesting problem with jQuery targetting
- Highlight current post ancestor parent menu items
- Add code to WordPress menu items by class
- How to customize submenus isn wordpress theme [closed]
- How to add html attributes to the “ul” html tag with “wp_nav_menu” function?
- Can I have a different menu for each parent page?
- remove class “sub-menu” from wordpress drop down menu
- Adding sub-menu item makes parent item unclickable
- Wrap list parent in div with wp_nav_menu menu
- Replace the slug of parent pages with # [closed]
- How to buid wordpress menu with auto width sub-menu items in dropdown menu without any items sharing one line [closed]
- Adding toggle-able element after menu item
- wp_get_archives doesn’t take effect from css or html
- How to use wp_nav_menu to create custom dropdown menu?
- Adding archive years to my menu
- How to Add support for sub-menu item description in wordpress?
- URL links consistent with menus?
- Replace anchor tag with span tag
- If current menu item is child or parent with child?
- Add menu headings to WordPress sub menus
- Custom menu – different submenu for first menu item
- How to check if current page is a parent item or child item in a given menu
- Removing Submenu from Menu
- Controlling sub-menu within sub-menu
- dropdown menu, with walker
- Set one or more menus as a submenus of another menu
- Custom menu with additional logic for display
- Change hover to onclick on menu
- Bootstrap Theme Migrated to WordPress
- WordPress + Bootstrap: Replace primary navigation menu on mobile?
- having a page in multi sub-menu and match current-menu-item
- Why my dropdown menu is effecting main menu?
- Creating navigation out of specific IDs and their children?
- Where to place a svg chevron down in my custom walker?
- Add href to tag in nav menu for mobile
- Incorrect Behavior on WordPress Main Menu
- How to access into the description of a sub menu
- Product categories are mixed when creating menu
- Importing large product categories into wordpress menu
- Adding span to a particular text in an menu item
- How can I create this menu with wp_nav_menu()?
- Foundation Scripts not loading (custom theme)
- Has there been any improvements to wp’s menu handling?
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- No indication of menu
- Always show wordpress submenu on responsive header menu
- Show Child of Parent Page including all other parents
- How to display list of child pages with parent in wordpress?
- nav_menu: how to force a subpage switching on the parent menu
- wp_dropdown_nav function to list menu items
- Use menu structure for permalinks
- Add tooltips with image in WordPress Menu?
- How to make a drop down menu with categories
- Building Menus with the latest posts included
- How to add drop down sub menu from database fields in the particular menu slug
- Display all submenus
- Adding Sub Menu In a theme which Do not have Menu Options
- wp_nav_menu changed to wp_page_menu
- Keeping my Sub Menu open when hovering on its list items
- Jquery dropdown menus working locally, but not in WordPress [duplicate]
- WordPress menu is getting automatically nested
- Menu items do not “open” when mouse hover over them?
- Add acf custom fields so sub item in menus