You can change the classes of the <ul>
by adding 'menu_class'=>'nav navbar-nav'
to your $args
array. Remember, this parameter overwrites all the classes, so add “menu” as well if you want many themes and plugins to work!
If you don’t want the outer <div>
, you can “unwrap” the <ul>
by adding 'container'=>false
.
$args = array(
'theme_location' => 'primary',
'menu_class' => 'nav navbar-nav',
'container' => false,
);
See the full reference here.
Related Posts:
- start_lvl Ignored in Custom walker_nav_menu
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- how to changes mobile menu toggle breakpoint in WordPress
- How do I change/modify the_post_thumbnail(); html output?
- Mega Menu Walker
- Displaying Logged-In User Name in WordPress Menu
- Hide main div if wp_nav_menu is empty
- Modify previous and next text from pagination links
- Check if a menu is empty?
- How to remove a metabox from menu editor page?
- Calling a method from functions.php on a click of a button
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- How to add active class to custom menu using while loop and wp_list_pages
- WordPress menu deletes when trying to add a hook
- Logout and redirect using the WP Menu
- HTML table from shortcode with multiple parameters
- Placing raw HTML inside a WordPress shortcode
- Have CSS Class Added with `is_page()` WP function
- Slide in Panel WordPress Post
- Shortcode content output but not in correct place
- Run a filter when a walker runs
- Removing unneccessary p-tags (Not every p)
- Add a class to the anchor tag on HTML5 gallery
- Menu — How to add “current-menu-grand-ancestor” css class
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- Converting HTML Template to WordPress Theme
- Populate dropdown with Child Pages based on Parent Page chosen
- How to store data from multiple forms using ajax and php
- Automatically adding new post categories to menu
- Add data attribute to each li in menu
- Use DOMDocument with ob_start breaks my HTML code
- Unique icons next to each WordPress menu item
- Child page menu in sidebar
- Title Case WordPress Menu Items
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- Add .htm extention to a custom taxonomy
- How to change menu order item
- Noscript not working as it should in wordpress site
- Add item to top of menu using a filter in functions.php
- How to make modifications only to certain elements of an HTML string on the server-side?
- Register a menu – Error Header
- Widget back end radio button issue
- Add data-id attribute to child page links
- Add login hyperlink to secondary navigation menu
- Add value to new attribute inside WordPress menu items
- Menu Custom Data Attributes
- Adding function to child theme’s function.php
- Get the name of menu item with wp_nav_menu
- How to use the checked() function to check for a non-empty var
- Calling function in loop causes repeat data
- How to add aria role and schema markup to custom walker container
- Nav-Menu not showing up
- Remove submenu item from list
- Dynamic Menu drops pages?
- Menu not styling. New menus functionality giving me a headache
- Time Delay a URL Redirect for Specific Page
- How to display already created menus via php?
- WordPress User Meta value variable into Google Gauge Chart
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- Adding HTML Code to Replace Text in PHP
- PHP function for horizontal Woocommerce thumbnails and badges
- How to use data URL in WordPress?
- HTML comment cause issue in functions.php script root
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- Remove span tags from WooCommerce Downloads page
- How to put 2 php codes in functions.php without site crashing
- Menu not updating for logged in users after redirect
- How to center all text body in single.php at once?
- Add element after navigation element title don’t works like I expect
- Add parent menu item in sub-menu in custom nav_walker
- How can I get my pagination loop to display the correct number of total pages?
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Can’t get_users info by using json_encode
- Vertical Menu for one page only
- Show post/page into div using function
- Pulling a variable into the wp_nav_menu function
- How I can add div to menu?
- wp nav menu without label
- Add extra markup to WP menus
- WordPress HTML Helper
- WordPress adding in site URL to header links
- Cant get theme to change footer color through theme customizer
- How do I modify the with wp_nav_menu()
- Sorting Problem
- Add multiple HTML attributes to an Elementor button
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to add different menu items on different menus?
- Is it possible to disable a function of a parent theme?
- WordPress Ajax always returns a 404 error
- Function set default image when image not present
- How to put “Read more” link in Custom Excerpt inside p tag?
- Get users that likes the post
- meaning of (array)function()
- Create shortcode for metabox gallery
- WooCommerce – Print Processing orders [closed]
- Warning: filemtime(): stat failed for wp_
- Keep users logged in Without Remember Me