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
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- start_lvl Ignored in Custom walker_nav_menu
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Display only page specific sub menu items using Custom Walker
- WordPress Menu Custom Walker Class
- Add class to top level menu item if it has multiple child levels
- Determine if a navigation item has children
- Add Page ID class to nav menu items
- Pass a parameter to a menu walker
- Walker class: Problems with understanding how walk() method can be called without error
- Custom nav walker with different output depending on depth
- Bar separated navigation by extending Walker_Page
- Output the aria-labelledby parameter for a nav menu child
- Custom Nav Walker sub-menu HTML construct
- Customizing a walker menu class
- How to add ID and class in nav menu walker?
- How to remove trailing tags from wp_nav_menu walker
- How to add parent element’s title to nav menu’s child?
- Custom Walker anchor tag not inheriting attributes
- Check what “type” a menu item is
- How to display dynamic content in start_lvl function
- Add custom text to menu
- How to add a tag to wp_nav_menu in a child theme
- Adding post excerpt into navigation 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
- Run a filter when a walker runs
- 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
- Add within the output of
- 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
- Sub Menu does not display using Nav Walker
- Is this format possible with a custom Nav Walker class?
- Put class on instead li
- Get Menu Name inside walker
- WordPress Menu Walker: add #hashes to child page links (only)
- WordPress Walker – Group two items?
- Where to implement custom walker class?
- custom walker class
- How do you add a around the second level of a Menu?
- Trying to store submenu items to render out after main menu
- Page content loading issue using Walker_Nav_Menu
- Walker Class – Check if menu item has description and if so add class to li
- Default menu editor with automatic page list
- Dynamic_sidebar inside wp_nav_menu
- How to add attribute in menu code
- How to remove dropdown from wp_nav_menu
- Walker menu not displaying at all
- Wrapping link and .sub-menu with wp_nav_menu
- Add login hyperlink to secondary navigation menu
- Show children (sub-navigation) of active menu item only
- wp_nav_menu check both hierarchy fail?
- Adding a unique ID to each sub-menu
- How to display different submenus?
- Get parents child pages
- Show Sidebar Menu Subpages When Clicking Parent
- How can I make wp_nav_menu() support tags?
- How to Add support for sub-menu item description in wordpress?
- 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?
- Adding a tag to wp_nav_menu
- Adding markup to sub menu based on class
- Why is my navigation in my onepage not working?
- Is it possible to get_the_post_thumbnail (Featured Image) inside a sprintf function?
- WordPress menu walker – help to add custom class for each submenu
- Need help with Walker_Nav_Menu class
- Structuring Nav Menu and Background Custom page (Help)
- why are my walker menu is showing like this?
- What is inside in $item in start_el function in Walker_Nav_Menu class
- Add parent menu item in sub-menu in custom nav_walker
- Add active class to wp_nav_menu
- how do you create this customize menu using wp_nav_menu function?
- Classes CSS (Optional) – how do I reference this in php?
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- Cannot add home page url to menu with #
- Show post titles within WordPress bootstrap Dropdown menu
- Add parent link to its submenu
- Creating custom Menu for custom theme
- Count Level 1 Childs for Custom Nav Walker WordPress
- Add dynamic content block to nav section generated by custom walker
- 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?
- Walker for menus
- 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)
- 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?