Try this walker.
Example usage:
wp_nav_menu( [
'menu_class' => 'menu-horizontal text-left',
'container' => '',
'depth' => 2,
'theme_location' => 'main-menu',
// You should have loaded the class-my-bs-walker-nav-menu.php file from
// within the theme's functions.php file.
'walker' => new My_BS_Walker_Nav_Menu,
] );
The walker is not intended as a “global” walker for any Bootstrap menus; instead, it was intended just for the menu structure that you provided in your question.
Related Posts:
- Split up wp_nav_menu with custom walker
- how to create a menu with all sub categories?
- How to avoid wp_nav_menu() ID conflict?
- How to change order of menu items
- Remove unusable metaboxes in nav menu management screen
- Highlight parent menu item when child is not in menu
- Add Commas Between Menu Items?
- Allow html tags in WordPress Custom Menus Description Field
- Add custom attribute to menu item link using Filter
- Remove nav menu or menu item
- Building a Sub-menu: Display Parent Category/Page’s Children When Viewing Children
- How to Create a Custom WordPress Navigation Menu with the Code?
- Show all parent pages and their children below from same author as currently viewed page
- How to add ID and class in nav menu walker?
- Set Item Order with wp_nav_menu_{$menu->slug}_items
- How can I get an array/list of all current WordPress Admin Menu items?
- Handling complex multi-level architecture / menu for large site
- WP Nav menu append to url
- Hiding Admin Page While Keeping Menu Expanded
- How to add a tag to wp_nav_menu in a child theme
- How can I remove data-target=”#” from bootstrap dropdown menu?
- Use wp_nav_menu to display ALL pages
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- Best way to customise wp_nav_menu [duplicate]
- How do I apply a class to custom menu items based on user roles
- Navigation Menus Depth for specific menus
- How to Overwrite/Customize wp-admin/nav-menus.php in WordPress
- Filter for Admin Nav Menus Drop Down
- How do you manage large menu hierarchies in WP?
- wp_list_pages() but only show children on the branch you are on
- Tidy nav menu classes except for edit-menu-item-classes and active class
- I need help adding a second custom menu item to the WooCommerce account area menu
- how can remove this element to avoid having two menu buttons with one that shows unnecessary pages
- Why aren’t my post showing under my custom menu?
- WordPress Menu Walker: add #hashes to child page links (only)
- Custom Menu’s – Disable Link checkbox
- Using my WordPress menu on another platform
- Header and nav menu problem on Thesis site [closed]
- How to style a specific nav menu item?
- remove class “sub-menu” from wordpress drop down menu
- Add a submenu to wp_nav_menu
- remove menu items if user can’t read
- Automatically going to the first page in a hierarchy?
- Is there a hook for nav menu item links to add custom css programatically?
- rearrange the posts by published date in Menu posts selection
- Setting color of specific menu items depending on page or post tag
- sub menu link is not working
- Orderby menu_order not working; menu is sorted on publish date
- Disable parent in wp_list_pages – WordPress
- Add scheduled page or post in the menu section on back-end
- Change Menu Button Text [closed]
- Show Sidebar Menu Subpages When Clicking Parent
- Menu page with three columns
- Current User In Custom Menu Item URL [closed]
- Creating other page than page.php
- Appearance > Menus > Left Sidebar > Add Toggle
- How to open a lightbox form from a navigation menu item
- Efficient wp mobile menu
- Echo Menu located in primary navigation
- Dynamically populate the menu when a new category is created
- Navigation item – current date in url
- How do you show horizontally the submenu in WordPress using the nav walker?
- why are my walker menu is showing like this?
- Bootstrap Theme Migrated to WordPress
- How to remove top menu item and font awesome icon in WordPress menu?
- Add “onclick” option to header menu item
- Menu with sub-items but without link
- Creating navigation out of specific IDs and their children?
- I can´t make the menu unclickable in an easy way
- 2nd level (drop-down) of the navigation menu not working [closed]
- Mobile menu not working – jQuery error?
- Migrate WP Menu between sites
- show a hidden ul if li is active
- How can I make menu items into two seperate buttons with different functions?
- Responsive Dropdown Menu
- How to separate sub-menu output and keep associated with parent
- How to style wp_nav_menu?
- How to inject HTML to secondary menu on front end?
- Different colors for navigation bar
- Eliminate menu collapse button on website
- Best way to build a 500 item menu
- Showing main menu and child menu in diffent places in a same page
- WordPress Navigation default output
- Specifying Class style for Menu
- Is there a limit to number of pages displayed for selection in custom menu?
- Convert HTML code to WordPress menu
- How to view menu and submenus in URL
- Permalinks linking to similar named site
- Add monthly archives menu and submenu
- wp nav menu – highlighting current page not working properly [closed]
- Hamburger Navigation Menu
- Custom navigation / menu output (walker?)
- How does WP knows which template to use for a page
- What is the best way to incorporate responsive dropdown navigation menu into custom theme?
- how to add permalink/slug to wordpress custom link menu item
- Using walker to display all menu branches at once?
- How to add a class directly on a unordered list element that is a primary navigation
- Submenu items not working anymore
- Icon not shown in Dropdown menus in Twenty Seventeen Theme
- How to change WP menu item type?