This is actually not that difficult if you already know how the walker class works. You would need two calls to wp_nav_menu
. The first one you have should already work, because the function natively allows you to select only the top level.
What it doesn’t allow you to is to select everything but the top level. So you need a separate walker, which you would call like this:
wp_nav_menu( array(
'theme_location' => 'primary',
'walker' => new wpse215647_walker(),
'container' => false,
) );
In your walker you must make sure all items are included, except the top level. That question already has an answer here.
Related Posts:
- Nav walker, bootstrap: Display 3rd level items under 2nd level
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- Display only page specific sub menu items using Custom Walker
- Multi Level Bootstrap Navigation Menu in WordPress
- Add class to top level menu item if it has multiple child levels
- Simple Navigation Walker – Wrapper-class around first sub-menu
- Output the aria-labelledby parameter for a nav menu child
- Custom Nav Walker sub-menu HTML construct
- Check if wp_nav_menu items have submenus
- Add div to specific sub-menu
- Sub-Pages only of menu items in current branch using a custom menu
- How to display dynamic content in start_lvl function
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- How to construct a custom html for submenus
- How to add ID attribute to each submenu?
- WordPress Walker – Group two items?
- Change submenu markup
- getting the current sub item out of total sub items in a given dropdown (custom walker)
- How to Add support for sub-menu item description in wordpress?
- How can I creat custom menu with bootstrap
- WordPress + Bootstrap: Replace primary navigation menu on mobile?
- Stuck while adding bootstrap navwalker class
- Menu walker: how to tell if a sub menu contains submenus?
- Where to place a svg chevron down in my custom walker?
- Displaying a part of a menu containing the page the user is currently viewing and only it’s immediate children
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- Broken drop down menu using Bootstrap and navwalker class
- nav tag wrapping around dropdown
- WordPress nav Walker – Bootstrap 5.2.3 – submenu not opening
- Remove WordPress Menu Classes and ID with Bootstrap Walker
- Display a portion/ branch of the menu tree using wp_nav_menu()
- Split up wp_nav_menu with custom walker
- Custom Nav walker display current menu item children, or siblings on no children
- Add a custom walker to a menu created in a widget
- Using a menu walker add a custom item at the end of the menu’s items
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- How to count nav menu items?
- How Does The Walker Class Work?
- Add custom menu item using wp_nav_menu_items filter
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- how to create a menu with all sub categories?
- How does a minimal menu walker look like?
- Add separator to admin submenu
- adding some custom html code to the wp_nav_menu function
- WordPress Menu Custom Walker Class
- How to create this custom menu walker?
- Call custom field into menu item
- add span class inside wp_nav_menu link anchor tag
- Add a .last class to the last in each ul.sub-menu
- Determine if a navigation item has children
- How show sub menu only using wp_nav_menu()
- Show only 2nd level of navigation depending on active navigation
- How do I pass an argument to my custom walker?
- How do I add the data-toggle=”modal” data-target=”#myModal” attribures to a WP Nav bar?
- Bootstrap drop down menu with wp_nav_menu
- How to get a separate child menu?
- Custom Nav Walker menu – Display children count
- wordpress nav menu using twitter bootstrap
- Exclude one item from wp_list_pages( $args );
- Add Page ID class to nav menu items
- Using string instead of object class instantiation on the walker argument breaks wp_nav_menu
- Pass a parameter to a menu walker
- wp_nav_menu() loses ‘current-menu-*’ classes on single product page within category
- HTML Bootstrap navigation menu to WordPress menu using wp_nav_menu
- How to drag multiple menu items at once in WordPress?
- Customizing the a tag with Semantic UI
- Adding attributes to link in wp_nav_menu using custom Walker function
- Walker_Nav_Menu: put custom code between a particular
- Show top-level parent with submenu menu walker
- Put a wp_nav_menu inside another one
- Adding a class (arrows) to main menu links that have children?
- Custom nav walker with different output depending on depth
- Adding html elements to wp nav menu
- How to make pages metabox display all hierarchy in menu admin?
- Bar separated navigation by extending Walker_Nav_Menu
- Add items to a menu dynamically
- Generate a Menu that displays all child pages of top level parent
- Bar separated navigation by extending Walker_Page
- How can I add a sub menu to an existing navigation menu in WordPress?
- start_lvl on Walker is not working
- Customizing a walker menu class
- Automatically Add New Tags to Sub-menu
- How to add ID and class in nav menu walker?
- wp_nav_menu custom walker – child items
- How to remove trailing tags from wp_nav_menu walker
- Adding different classes to anchor in navigation menu
- How to add parent element’s title to nav menu’s child?
- Add Bootstrap dropdown class to a nav menu
- how to only add a top-level admin menu without it creating a sub-level-menu
- how to automatically generate hierarchical menus from hierarchy of pages?
- Custom Walker for Walker_Nav_Menu
- Arrow down in menu not displaying
- Programmatically adding menu items function replicates in multiple menus
- wp_nav_menu – page template name as item class
- Make compatible custom menu widget for Twitter Bootstrap
- Handling complex multi-level architecture / menu for large site
- Loop through Navbar, Output Icons
- `start_el` depth argument in custom nav walker always evaluates to zero
- Custom Walker anchor tag not inheriting attributes
- Indirect modification of overloaded property WP_Post::$classes has no effect