Looks like you missed the {
for foreach
Change this line:
foreach ( $top_level_elements as $e )
to
foreach ( $top_level_elements as $e ) {
And don’t forget to complete the curly bracket after the end of loop.
Related Posts:
- Split up wp_nav_menu with custom walker
- Custom Nav walker display current menu item children, or siblings on no children
- Add a custom walker to a menu created in a widget
- Using a menu walker add a custom item at the end of the menu’s items
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Mega Menu Walker
- How to count nav menu items?
- How Does The Walker Class Work?
- start_lvl Ignored in Custom walker_nav_menu
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- How does a minimal menu walker look like?
- Display only page specific sub menu items using Custom Walker
- WordPress Menu Custom Walker Class
- How to create this custom menu walker?
- Call custom field into menu item
- add span class inside wp_nav_menu link anchor tag
- Add class to top level menu item if it has multiple child levels
- Determine if a navigation item has children
- How do I pass an argument to my custom walker?
- Simple Navigation Walker – Wrapper-class around first sub-menu
- Custom Nav Walker menu – Display children count
- Add Page ID class to nav menu items
- Using string instead of object class instantiation on the walker argument breaks wp_nav_menu
- Pass a parameter to a menu walker
- Adding attributes to link in wp_nav_menu using custom Walker function
- Walker_Nav_Menu: put custom code between a particular
- Walker class: Problems with understanding how walk() method can be called without error
- Show top-level parent with submenu menu walker
- Adding a class (arrows) to main menu links that have children?
- Custom nav walker with different output depending on depth
- Adding html elements to wp nav menu
- Bar separated navigation by extending Walker_Nav_Menu
- Bar separated navigation by extending Walker_Page
- Output the aria-labelledby parameter for a nav menu child
- Custom Nav Walker sub-menu HTML construct
- Check if wp_nav_menu items have submenus
- start_lvl on Walker is not working
- Customizing a walker menu class
- Add div to specific sub-menu
- How to add ID and class in nav menu walker?
- wp_nav_menu custom walker – child items
- How to remove trailing tags from wp_nav_menu walker
- How to add parent element’s title to nav menu’s child?
- 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
- Custom Walker anchor tag not inheriting attributes
- Indirect modification of overloaded property WP_Post::$classes has no effect
- Benefits of using Nav Walker?
- Check what “type” a menu item is
- Use walker for specific menu, or avoid use of walker
- WordPress customizing a walker menu class
- Add active class to wp_nav_menu
- Output existing wp_nav_menu with a custom walker
- How to remove a sub-menu using walker hooks/filters without relying on a custom walker?
- how to split vertical menu into two columns using walker nav menu
- how do you create this customize menu using wp_nav_menu function?
- Classes CSS (Optional) – how do I reference this in php?
- Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items
- 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?
- Custom menu with Walker class – what should the $db_fields be?
- Cannot add home page url to menu with #
- Show post titles within WordPress bootstrap Dropdown menu
- Add parent link to its submenu
- Is it possible to separate all submenu items?
- Creating custom Menu for custom theme
- Check in walker if current page is descendant
- Count Level 1 Childs for Custom Nav Walker WordPress
- How can I edit submenu headings using wp_nav_menu walker?
- Specific Page that convert Hyperlink to anchor in nav menu
- Can’t add optional class to menu item when using Walker_Nav_Menu
- Add dynamic content block to nav section generated by custom walker
- Customize Walker_nav_menu to show posts if item is category
- Add the “.current-menu-item” class to tag?
- Need direction on a seemingly complex menu walker for automatically inserting a parent link li in it’s submenu ul
- Additional class for.sub-menu UL?
- How can I modify wp_nav_menu with walker?
- Determine if a navigation item has children
- Walker for menus
- Use wp_nav_menu to dynamically generate child menus
- wp_nav_menu – Collapse with PHP
- Custom Links in Walker Class
- custom walker to add iconfont to wp_nav_menu
- I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?
- how to make a walker to this (in bootstrap, i try but not work)
- Broken drop down menu using Bootstrap and navwalker class
- how can i get the page_ID in nav li [closed]
- Custom navigation / menu output (walker?)
- Using walker to display all menu branches at once?
- WordPress nav Walker – Bootstrap 5.2.3 – submenu not opening
- Nav walker bootstrap: Display 3rd level and 4th level in dropdown menu
- Remove WordPress Menu Classes and ID with Bootstrap Walker