You want to modify the start_el
method as you did the start_lvl
one. At its most basic it would mean altering this line:
$item_output .= '<a'. $attributes .'>';
To look like this one:
$item_output .= '<a class="dropdown-toggle" data-toggle="dropdown"'. $attributes .'>';
It looks like you will need more complicated logic to avoid inserting that string in all the submenus, but that is the idea.
Related Posts:
- Using a menu walker add a custom item at the end of the menu’s items
- How to count nav menu items?
- How Does The Walker Class Work?
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Display only page specific sub menu items using Custom Walker
- How to create this custom menu walker?
- Call custom field into menu item
- Add class to top level menu item if it has multiple child levels
- How do I pass an argument to my custom walker?
- Simple Navigation Walker – Wrapper-class around first sub-menu
- Add Page ID class to nav menu items
- Pass a parameter to a menu walker
- Show top-level parent with submenu menu walker
- Bar separated navigation by extending Walker_Nav_Menu
- Check if wp_nav_menu items have submenus
- start_lvl on Walker is not working
- wp_nav_menu custom walker – child items
- Nav walker, bootstrap: Display 3rd level items under 2nd level
- wp_nav_menu – page template name as item class
- Sub-Pages only of menu items in current branch using a custom menu
- `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
- has_children in custom nav_walker
- Counting top level items in a custom menu walker
- How can I add divs or change li in the submenu of the menu_nav
- Main Menu and Sub Menu Items for Footer
- Get number of root elements in walker class
- How to construct a custom html for submenus
- Remove current class from sub menu items
- View h2 content tags of a page in sub menu
- Change an li class name in a wordpress custom menu walker
- Custom walker nav – Add sequential number as class
- Getting menu items like get_pages
- WP Menu Walker – How to know total depth from inside the start_lvl() method
- How to add ID attribute to each submenu?
- How to create this Custom Walker Menu
- Determine the last child of the parent menu WP Nav Walker
- Create a MegaMenu using a walker and the start_lvl function
- Navigation doesn’t render when wp is hosted
- CSS_Menu_Walker not showing on mobile view?
- wp_nav_menu add class to child item with sub child
- Change submenu markup
- getting the current sub item out of total sub items in a given dropdown (custom walker)
- How to use a start_el variable in start_lvl
- Split into two seperate unordered lists with custom walker
- creating a custom walker class
- How to actually make menu walker alive on admin interface?
- Wrapping link and .sub-menu with wp_nav_menu
- Show children (sub-navigation) of active menu item only
- wp_nav_menu check both hierarchy fail?
- Wrapping menu’s top-level link and sub-menus in div
- Remove a class from a using Walker
- How to convert the argument of wp_list_pages to an array
- How to change the menu mark up with walker_nav_menu class?
- Walker Class: Output Parent Description and Featured Image right after sub-menu?
- Modifying the walker to insert parent’s description above sub menus
- How to add scroll IDs to WordPress menu anchors
- wp_list_pages Hierarchical Help
- custom walker class for own menu?
- How to get current pages menu text?
- Costum walker with sub menu item count
- How do I add 3rd level of dropdowns to wp_nav_menu array?
- Add attributes to wrapper html generated by wp_nav_menu
- How to include second layer sub menu to Walker Nav?
- url_to_postid method in walker_nav navigation menu causing exceptionally high TTFB
- How can I creat custom menu with bootstrap
- Structuring Nav Menu and Background Custom page (Help)
- Can I now add a class in the anchor of my menu item with WordPress 5.4?
- Stuck while adding bootstrap navwalker class
- Multi-Level Nav Bar
- Adding additional html to the end of the root level in a custom nav walker
- wordpress custom menu – show parents, siblings, children depending on depth
- Nav_walker add id to dropdown ul
- Change markup for just 2nd list element in custom Walker menu
- Menu walker: how to tell if a sub menu contains submenus?
- WordPress customizing a walker menu class
- How to remove a sub-menu using walker hooks/filters without relying on a custom walker?
- how do you create this customize menu using wp_nav_menu function?
- Parent link need to go first child submenu
- Displaying a part of a menu containing the page the user is currently viewing and only it’s immediate children
- Custom wordpress submenu
- Walker or wp_get_nav_menu_items VS jQuery
- WPML CMS Nav and Custom Nav_Walker Undefined Property Notices [closed]
- 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?
- Cannot add home page url to menu with #
- Is it possible to separate all submenu items?
- Check in walker if current page is descendant
- Specific Page that convert Hyperlink to anchor in nav menu
- Add dynamic content block to nav section generated by custom walker
- Customize Walker_nav_menu to show posts if item is category
- How can I modify wp_nav_menu with walker?
- Walker for menus
- Use wp_nav_menu to dynamically generate child menus
- Broken drop down menu using Bootstrap and navwalker class
- how can i get the page_ID in nav li [closed]
- Using walker to display all menu branches at once?
- WordPress nav Walker – Bootstrap 5.2.3 – submenu not opening