Here are a couple things I noticed.
You don’t want to include the <a>
inside of link_before
or link_after
, you will get 2 links if you do that. You also don’t need the <ul>
. Instead I think you want something like this…
<?php
wp_nav_menu(array(
'theme_location' => 'primary',
'before' => '<class="nav-item active">',
'menu_class' =>'navbar-nav mr-auto',
'link_before' =>'<span class="nav-link">',
'link_after' =>'</span>',
'container' => false,
'items_wrap' => '%3$s'
));
?>
You should read more about wp_nav_menu.
Related Posts:
- How to add or remove borders in navigation menu?
- Programmatically add a Navigation menu and menu items
- Adding an Arbitrary Link to the Admin Menu?
- Dynamically exclude menu items from wp_nav_menu
- Split up wp_nav_menu with custom walker
- Is there an easy way to replace a custom menu link with a page or post?
- How to Add to Each Menu Link with link text to data-attr?
- Add Javascript to WordPress Menu
- Filter wp_nav_menu()
- Add custom classes to anchor in wp_nav_menu
- How to modify navigation menu of the “My Account” page in WooCommerce
- Custom ID for certain menu item?
- Add data-icon input to WordPress custom menu links
- Show just one level of child pages, wp_list_pages woe
- Removing link ” from ” menu for some “links” without JS
- Show current navigation path from menu
- Active page link not getting class assigned
- Add dynamic content block to nav section generated by custom walker
- Add a Submenu from Another Submenu in a Custom Theme
- Highlighting Main Navigation Menu With Two or More Class Matches
- Next/previous a-like single navigation
- nav_menu: how to force a subpage switching on the parent menu
- wp_dropdown_nav function to list menu items
- Customize Walker_nav_menu to show posts if item is category
- wp_nav_menu() reutrns HTTPS?
- Menu not always using correct link
- How to output the menue structured for tabbed navigation?
- Replace Menu Item with Logged in username
- Where these arguments are defined?
- Show only second level menu items? [duplicate]
- Add item ONLY to the primairy navigation
- wp_nav_menu in 3.7 add name class nav navbar-nav
- Update nav menu item position programmatically
- Navigational error
- Remove from wp_nav_menu() wordpress
- Determine if a navigation item has children
- Image menu on responsive WordPress
- Walker for menus
- wp_nav_menu: indicate by id page grandparents
- individual images as navigation design TwentyTen
- WordPress Navigation
- WordPress Navigation default output
- How to call either page name as the nav link or navigation title?
- how to keep theme background image, menu or site header image while moving site in sub directory?
- Second tier sidebar navigation
- How to get wordpress navigation to work
- wordpress superfish dropdown menu
- Add custom ID to wp_nav_menu list items
- Show All Children of WordPress Menu
- Navigation list not correctly styled on pages with custom template (missing .current-menu-item)
- Make title bar collapse when scrolling
- Unable to edit Navigation bar
- Display Username as parent menu item
- How do I show a different secondary navigation menu for each section of my website?
- How to make navigation a list without a plugin? [duplicate]
- Add a navigation menu item using MySQL
- how to make a walker to this (in bootstrap, i try but not work)
- How to make an anchored page in a navigation menu tab
- Customizing Responsive Themes Menu [closed]
- Some informations about the use of statics pages in WordPress
- How was this menu system created?
- Site pages show the page title under navigation bar
- Creating an accordion style menu
- Display sub menus as separate lists
- How can I added the post’s Categories to the site’s top menu (like a page)?
- Site navigation sits unstyled for a second on page reload [closed]
- how can i get the page_ID in nav li [closed]
- How do i add logo in wordpress studiopress (glam theme)?
- Navigation menu, remove item from desktop
- Wrapping my ‘s with
- Custom navigation / menu output (walker?)
- How can I structure my pseudo footer nav code with wordpress codex code?
- The menu jumps a few pixels after the website loads
- Two Homes In Navigation Menu
- How to set menu Display location
- Add featured posts to nav menu
- WordPress “add to menu” button not working
- How to add a class directly on a unordered list element that is a primary navigation
- How do I programatically remove Menus?
- Navigation menu displays permalinks
- Displaying a Custom Avatar in WP Bootstrap Navwalker Menus in WordPress
- Is there a way to make it so that I don’t get a hamburger menu, but rather a desktop style nav, when resizing to a mobile size
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)
- Give custom class names to WP nav sub-menu
- Tried to hide navigation menu on one page ended up SCRAMBLING the navigation menu on another
- Render link description in navigation block
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- Header not showing in new pages
- Off-Canvas Menu Toggle Issue After WordPress Core Update
- wp_nav_menu parent in submenu
- Add a new menu selector element into WordPress nav-menus.php
- I only want to show links to categories that have posts in ‘publish’ state in my menu
- Can I create main menu without using built-in menu
- Remove WordPress Menu Classes and ID with Bootstrap Walker
- How to get and set post meta for core/navigation-link?
- How to add toggle-able DOM element after nav menu item?
- Is there any documentation on JS trigger for the Gutenberg “Navigation” block?
- Primary menu item is not highlighting when page is active even though it is linked from a url with query string to pre-populate a form field
- How to get the navigation menu items? [closed]
- Change color of active link to navigation menu