I solved it. I thought it could work but i wasn’t sure, and i wanted some opinion from more experienced people. Anyways, this is what i have done:
First of all, i defined a private var in my walker class:
private $el;
In my start_el() function, i filled this var with $item
$this->el = $item;
At this point, i was able to access any item’s property from start_lvl()
$output .= "{$n}{$indent}<ul class=\"dropdown-menu\" aria-labelledby=\"link-".$this->el->ID."\">{$n}";
Oh well, that was simple, but i hope i’ll help someone
Related Posts:
- Nav walker, bootstrap: Display 3rd level items under 2nd level
- Main Menu and Sub Menu Items for Footer
- WordPress Walker – Group two items?
- Stuck while adding bootstrap navwalker class
- Broken drop down menu using Bootstrap and navwalker class
- WordPress nav Walker – Bootstrap 5.2.3 – submenu not opening
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- Split up wp_nav_menu with custom walker
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Display only page specific sub menu items using Custom Walker
- adding some custom html code to the wp_nav_menu function
- WordPress Menu Custom Walker Class
- Multi Level Bootstrap Navigation Menu in WordPress
- Determine if a navigation item has children
- Bootstrap drop down menu with wp_nav_menu
- Add Page ID class to nav menu items
- Pass a parameter to a menu walker
- Custom nav walker with different output depending on depth
- Bar separated navigation by extending Walker_Page
- Customizing a walker menu class
- How to add ID and class in nav menu walker?
- How to add parent element’s title to nav menu’s child?
- wp_nav_menu – page template name as item class
- `start_el` depth argument in custom nav walker always evaluates to zero
- Add custom text to menu
- How to add a tag to wp_nav_menu in a child theme
- Adding post excerpt into navigation menu
- How can I remove data-target=”#” from bootstrap dropdown menu?
- Use wp_nav_menu to display ALL pages
- Third level navigation class
- Editing WordPress Nav Menu Walker
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- How can I add divs or change li in the submenu of the menu_nav
- Get number of root elements in walker class
- Get top items number from wordpress menu
- add span class and i tag inside wp_nav_menu link anchor tag
- How to Overwrite/Customize wp-admin/nav-menus.php in WordPress
- Remove current class from sub menu items
- Use menu class in walker function
- Getting menu items like get_pages
- wp_list_pages() but only show children on the branch you are on
- Walker class conditional based on parent menu item label or custom css class
- How to create this Custom Walker Menu
- Sub Menu does not display using Nav Walker
- Put class on instead li
- Get Menu Name inside walker
- WordPress Menu Walker: add #hashes to child page links (only)
- Where to implement custom walker class?
- custom walker class
- wp_nav_menu add class to child item with sub child
- Page content loading issue using Walker_Nav_Menu
- Sticky Header in WordPress using BootstrapWP theme [closed]
- creating a custom walker class
- Walker Class – Check if menu item has description and if so add class to li
- How to actually make menu walker alive on admin interface?
- Show children (sub-navigation) of active menu item only
- Remove a class from a using Walker
- wp_nav_menu: Is there a way to modify the output of that got a submenu?
- Make two bootstrap menus collapse into one dropdown
- 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
- wp_list_pages Hierarchical Help
- 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?
- WordPress + Bootstrap: Replace primary navigation menu on mobile?
- 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
- Navbar is hidden behind carousel when using wp-boostrap-navwalker
- Change markup for just 2nd list element in custom Walker menu
- Menu walker: how to tell if a sub menu contains submenus?
- Change menu for mobile
- 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?
- 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
- Customize Walker_nav_menu to show posts if item is category
- Use wp_nav_menu to dynamically generate child menus
- nav tag wrapping around dropdown