You use the walker in your theme, wherever you call your nav menu.
So for example, if you currently have a “topnav” menu in your theme, like this:
wp_nav_menu(array('menu' => 'topnav');
and your custom walker is called “myCustomWalker”, you would update the wp_nav_menu
call like this:
wp_nav_menu(
array(
'menu' => 'topnav',
'walker' => new myCustomWalker()
)
);
Just make sure to work in a child theme, so that when your theme updates, your call to the new walker (and the walker itself) are not lost.
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
- Call custom field into menu item
- Add class to top level menu item if it has multiple child levels
- Determine if a navigation item has children
- Simple Navigation Walker – Wrapper-class around first sub-menu
- Add Page ID class to nav menu items
- Pass a parameter to a menu walker
- Bar separated navigation by extending Walker_Page
- Check if wp_nav_menu items have submenus
- start_lvl on Walker is not working
- 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?
- Nav walker, bootstrap: Display 3rd level items under 2nd level
- wp_nav_menu – page template name as item class
- `start_el` depth argument in custom nav walker always evaluates to zero
- Benefits of using Nav Walker?
- Add custom text to menu
- has_children in custom nav_walker
- 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
- 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
- Change an li class name in a wordpress custom menu walker
- Use menu class in walker function
- Custom walker nav – Add sequential number as class
- 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
- WP Menu Walker – How to know total depth from inside the start_lvl() method
- 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)
- WordPress Walker – Group two items?
- 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
- Split into two seperate unordered lists with custom walker
- creating a custom walker class
- Walker Class – Check if menu item has description and if so add class to li
- How to add attribute in menu code
- How to remove dropdown from wp_nav_menu
- 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?
- Adding a unique ID to each sub-menu
- How can I make wp_nav_menu() support tags?
- 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
- 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
- Is it possible to get_the_post_thumbnail (Featured Image) inside a sprintf function?
- How can I creat custom menu with bootstrap
- WordPress menu walker – help to add custom class for each submenu
- Structuring Nav Menu and Background Custom page (Help)
- Stuck while adding bootstrap navwalker class
- What is inside in $item in start_el function in Walker_Nav_Menu class
- 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
- 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?
- Classes CSS (Optional) – how do I reference this in php?
- Displaying a part of a menu containing the page the user is currently viewing and only it’s immediate children
- Walker or wp_get_nav_menu_items VS jQuery
- 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
- Creating custom Menu for custom theme
- Specific Page that convert Hyperlink to anchor in nav menu
- Add dynamic content block to nav section generated by custom walker
- Additional class for.sub-menu UL?
- How can I modify wp_nav_menu with walker?
- Walker for menus
- Use wp_nav_menu to dynamically generate child menus
- 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]
- WordPress nav Walker – Bootstrap 5.2.3 – submenu not opening