By default wp_nav_menu() outputs the navigation markup. If you want to store it or want to concatenate it with other string then you’d have to set the echo parameter to false (by default it’s true).
$output .= '<ul class="sub-menu">
' . wp_nav_menu( array(
'theme_location' => 'col_1',
'menu_id' => 'col_1',
'menu_class' => 'col_1',
'container' => '',
'echo' => false,
) ) . '
</ul>';
Related Posts:
- Split up wp_nav_menu with custom walker
- Call custom field into menu item
- add span class inside wp_nav_menu link anchor tag
- Determine if a navigation item has children
- Add Page ID class to nav menu items
- Bar separated navigation by extending Walker_Nav_Menu
- Bar separated navigation by extending Walker_Page
- Custom Nav Walker sub-menu HTML construct
- `start_el` depth argument in custom nav walker always evaluates to zero
- Benefits of using Nav Walker?
- Use walker for specific menu, or avoid use of walker
- How to display dynamic content in start_lvl function
- Add custom text to menu
- has_children in custom nav_walker
- Adding post excerpt into navigation menu
- Use wp_nav_menu to display ALL pages
- Third level navigation class
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- add span class and i tag inside wp_nav_menu link anchor tag
- Change an li class name in a wordpress custom menu walker
- Add within the output of
- Is this format possible with a custom Nav Walker class?
- walker – 0 level on submenu formatting
- Determine the last child of the parent menu WP Nav Walker
- Navigation doesn’t render when wp is hosted
- How do you add a around the second level of a Menu?
- Help with walker for nav
- How to remove dropdown from wp_nav_menu
- How Do I Add Images To Main Navigation Menu
- Walker menu not displaying at all
- Show children (sub-navigation) of active menu item only
- Adding a unique ID to each sub-menu
- Remove a class from a using Walker
- How to Add support for sub-menu item description in wordpress?
- wp_list_pages Hierarchical Help
- changing the labels inside appearance -> menus for some for the fields
- Costum walker with sub menu item count
- How do I add 3rd level of dropdowns to wp_nav_menu array?
- Help with WordPress Custom Nav Walker
- Why is my navigation in my onepage not working?
- url_to_postid method in walker_nav navigation menu causing exceptionally high TTFB
- Is it possible to get_the_post_thumbnail (Featured Image) inside a sprintf function?
- Can I now add a class in the anchor of my menu item with WordPress 5.4?
- What is inside in $item in start_el function in Walker_Nav_Menu class
- Multi-Level Nav Bar
- Adding additional html to the end of the root level in a custom nav walker
- Change markup for just 2nd list element in custom Walker menu
- Where to place a svg chevron down in my custom walker?
- Add active class to wp_nav_menu
- how to split vertical menu into two columns using walker nav menu
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Creating custom Menu for custom theme
- Check in walker if current page is descendant
- Can’t add optional class to menu item when using Walker_Nav_Menu
- Add dynamic content block to nav section generated by custom walker
- Customize Walker_nav_menu to show posts if item is category
- Determine if a navigation item has children
- Walker for menus
- how to make a walker to this (in bootstrap, i try but not work)
- how can i get the page_ID in nav li [closed]
- Custom navigation / menu output (walker?)
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- Dynamically exclude menu items from wp_nav_menu
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Display only page specific sub menu items using Custom Walker
- how to automatically generate hierarchical menus from hierarchy of pages?
- Add sidebars to navigation menu?
- Remove li from wp_nav_menu
- Editing WordPress Nav Menu Walker
- How do I create page navigation linking to each H2 within the page? [closed]
- I am facing a problem with the navigation menu of my website
- Prepend to start of WordPress nav loop
- You do not have permission to create Navigation Menus – Twenty Twenty-Two theme
- Walker class conditional based on parent menu item label or custom css class
- custom walker class
- Walker Class – Check if menu item has description and if so add class to li
- Make a navigation menu in the same post [duplicate]
- How to actually make menu walker alive on admin interface?
- Get menus created with menu editor?
- Missunderstanding of WordPress menus
- How to add schema.org SiteNavigationElement and property URL to navbar?
- Theme Location empty
- how to remove description from menu buttons?
- How to buid wordpress menu with auto width sub-menu items in dropdown menu without any items sharing one line [closed]
- Wrapping menu’s top-level link and sub-menus in div
- wp_nav_menu: Is there a way to modify the output of that got a submenu?
- Make two bootstrap menus collapse into one dropdown
- How to convert the argument of wp_list_pages to an array
- Additional CSS for the nav menu
- Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items
- Unable to remove page from primary menu
- Show navigation header menu by post and categery
- How to Use Default Auto-Generated Menu?
- wp-nav menu with custom walker , how to remove a tag if it has any submenu
- wordpress superfish dropdown menu
- Site pages show the page title under navigation bar
- Wrapping my ‘s with
- How to get the navigation menu items? [closed]