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
- 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
- Custom Nav walker display current menu item children, or siblings on no children
- Add custom menu item using wp_nav_menu_items filter
- Add separator to admin submenu
- How show sub menu only using wp_nav_menu()
- Custom Nav Walker menu – Display children count
- HTML Bootstrap navigation menu to WordPress menu using wp_nav_menu
- Walker_Nav_Menu: put custom code between a particular
- Show top-level parent with submenu menu walker
- Adding a class (arrows) to main menu links that have children?
- Adding html elements to wp nav menu
- Bar separated navigation by extending Walker_Nav_Menu
- Add items to a menu dynamically
- How can I add a sub menu to an existing navigation menu in WordPress?
- wp_nav_menu custom walker – child items
- Adding different classes to anchor in navigation menu
- Arrow down in menu not displaying
- Getting post content within wp_nav_walker
- Show menu based on parent & ancestor
- How to include a third level with wp_get_nav_menu_items function
- Add dynamic Sitemap to footer
- Schedule Page to Menu [duplicate]
- Update body class based on menu
- How do I separate link levels in a custom menu walker?
- Is this format possible with a custom Nav Walker class?
- Add code to WordPress menu items by class
- Difference between walker class and basic php
- Custom navigation structure with walker class
- How do you add a around the second level of a Menu?
- How to add class to parent a tag with a sub menu
- Help with walker for nav
- Why is only the first operation run in my loop – except for on the last repeat? [closed]
- How Do I Add Images To Main Navigation Menu
- Wrap list parent in div with wp_nav_menu menu
- WordPress + Bootstrap [closed]
- WordPress Nav Walker – Top menu link with dropdown link not clickable (dropdown opens)
- Displaying Nav Menu
- Adding toggle-able element after menu item
- Add custom class to li element which has children
- URL links consistent with menus?
- Responsive menu on genesis theme [closed]
- How to check if current page is a parent item or child item in a given menu
- changing the labels inside appearance -> menus for some for the fields
- Removing Submenu from Menu
- Controlling sub-menu within sub-menu
- Walker_Nav_Menu creating too many closing tags?
- Bootstrap menu – make menu entries with submenu not clickable
- Hook or callback when wp_nav_menu() has completed
- Set one or more menus as a submenus of another menu
- Custom menu with additional logic for display
- Help with WordPress Custom Nav Walker
- Putting footer links into different columns
- Why my dropdown menu is effecting main menu?
- Does the Default theme of WordPress like 2016, 2017 and 2019 uses Walker_Nav_Menu Class
- How to create a mobile menu full screen overlay using Understraps Bootstrap 4 theme
- Add href to tag in nav menu for mobile
- How to change navwalker’s dropdown mark-up?
- how to split vertical menu into two columns using walker nav menu
- Bootstrap navbar responsiveness on WordPress theme menu not working
- Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items
- Custom menu with Walker class – what should the $db_fields be?
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- Always show wordpress submenu on responsive header menu
- Can’t add optional class to menu item when using Walker_Nav_Menu
- nav_menu: how to force a subpage switching on the parent menu
- Use menu structure for permalinks
- Add tooltips with image in WordPress Menu?
- Building Menus with the latest posts included
- How to add drop down sub menu from database fields in the particular menu slug
- wp_nav_menu – Collapse with PHP
- custom walker to add iconfont to wp_nav_menu
- wp_nav_menu changed to wp_page_menu
- Should I custom code drop down menus or use a wordpress plugin?