How do I go about inserting a custom div before the wp_nav_menu() adds the ul?
That’s what the 'container' array key defines: the element that contains the menu.
The menu will always output as a <ul>, wrapped in a container of the type specified by the 'container' array key: either a <div> (default), by passing 'div'; <nav>, by passing 'nav'; or none, by passing false.
So, if you want to wrap your nav menu in a <div class="menu-button">, use the following array arguments:
array(
'container' => 'div',
'container_class' => 'menu-button'
)
(Though, again, 'div' is the default value, so you can omit it if you want.)
Related Posts:
- Dynamically exclude menu items from wp_nav_menu
- Add custom menu item using wp_nav_menu_items filter
- Custom search filter causes menu and query_posts problems
- Unregister Nav Menu from Child-Theme
- Allow html tags in WordPress Custom Menus Description Field
- Using filters to change href of nav menu page link
- How to apply a class to the second word in menu list item?
- WordPress nav_menu_link_attributes Not Working
- Is it possible to add a filter for the output of nav-menu items in admin?
- if role is logged in then do something
- Filter menu item to add classes/attributes?
- Edit html for menu items in default frontend menu
- Set Item Order with wp_nav_menu_{$menu->slug}_items
- When at / ( or “home”) my menu doesn’t get a current-menu-item class
- How to add parent element’s title to nav menu’s child?
- Why is ‘nav_menu_item_args’ filter’s $item argument empty?
- Add class to active element and its parent in nav menu
- display only the wp_nav_menu, which has the current-menu-item
- Removing strip_tags not working on nav_menu_description
- Third level navigation class
- How to add #navbar to all page links?
- add span to top level links of a wordpress menu called “main”
- Debugging – trying to add search box to menus
- wp_list_pages() but only show children on the branch you are on
- From a page, is it possible to find entry’s “menu_item_parent”?
- Add active class to top-level menu items when viewing single for that post type
- add_filter on menu items to add a menu item
- how to disable default menu classes
- Insert other menus as submenus of a main menu
- list category posts under its item in menu
- Prevent menu from loading in a page template [duplicate]
- How to change menu structure?
- Secondary Navigation Menudisappeared When using wp_nav_menu_items
- remove specific classes from menu items
- wp_nav_menu action/filter help
- add_filter for where statment issue
- Add a counter beside menu item label
- Add custom link on the fly to nav menu
- menu-item class missing on wordpress menu
- Filter to hook into menu items and add a custom attribute
- if role is logged in then do something
- Possible to append class to nav menu added to widget area?
- Modifying Woocommerce menu based on tags and categories
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Menu location switcher – example code fails
- Add Featured Image and Title to wp_nav_menu items
- Show thumbnail to category items in wp_nav_menu(), how?
- Add Class to Custom Menu Widget ul
- Avoid changing menu query with suppress_filters => false
- Removing menu item doesn’t get removed on edit post
- Add Protocol to Custom Menus
- How to modify menu text in callback function of ‘walker_nav_menu_start_el’ hook
- Why is WordPress stripping anchor links from mneu item URLs?
- Add button and title on submenu WordPress
- In WordPress, I want to use code to filter out one menu item (page) from displaying when I call wp_nav_menu() function
- How do I access the menus produced by Dashboard > Appearance > Menus
- Adding existing links to custom navigation menus?
- Excluding a media query from specific pages
- Use dashicons in menu items?
- Custom menu with different behavior for every item
- Responsive dropdown menu with smaller screen sizes
- Menu separator appearing on next line
- Why is my array of nav menus returning empty?
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- How to create a complete mulilanguage site using xili language plugin?
- Add pages content to startpage through custom menu
- Can you exclude child pages of a specific parent within a navigation?
- WordPress Menu Problem
- How can I remove the navigation menu from a Page that is not on the menu?
- get_nva_menu_locations returns only filled ones
- Add attributes to wrapper html generated by wp_nav_menu
- Get Each Menu Nav Label of Menus in HTML tag
- How can I click the parent menu then redirect to a special URL?
- Stuck while adding bootstrap navwalker class
- use value returned from shortcode as menu item
- Hiding specific navigation menus from specific roles in admin panel
- Create a menu item with a blank title
- Navigation bar is on live site but nothing under menu so can’t add in a page
- WordPress menu issue after update
- Displaying a part of a menu containing the page the user is currently viewing and only it’s immediate children
- Menu’s built in the edit theme view do not have active states set when on child pages
- How to create menu in Word Press 4.2.2?
- Mobile Menu Not Working
- wp_nav_menu list children if on parent page but sibling if on sibling page
- custom rearranged menu with excerpt for selected children in sidebar.php
- Programatically retreive page content from its template page
- Menu – custom structure
- TwentyTwelve child theme: Incorrect footer menu
- adding a numbers to a item from navigation menu
- Rogue current menu item class in wp_nav_menu()
- Use wp_nav_menu to dynamically generate child menus
- To Add Logout Button in Menu [duplicate]
- Add qtranslate language select box to menu [closed]
- Custom menus not showing
- menu_class showing up on DIV instead of UL
- deleted menu still present [closed]
- Nav menu custom html:
- Broken drop down menu using Bootstrap and navwalker class
- Is it possible to animate the Twenty Eleven menu? [closed]