You don’t need a walker in this case. A filter called wp_nav_menu_items
is available. It allows you to edit the list items of a menu. Just append your own list item with search field.
add_filter( 'wp_nav_menu_items', 'add_search_to_nav', 10, 2 );
function add_search_to_nav( $items, $args )
{
$items .= '<li>SEARCH</li>';
return $items;
}
Note: if you only want to target a specific menu, a dynamic filter exists:
wp_nav_menu_{$menu->slug}_items
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
- 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
- WordPress Menu Custom Walker Class
- add span class inside wp_nav_menu link anchor tag
- Determine if a navigation item has children
- 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
- 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
- Add div to specific sub-menu
- 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
- Indirect modification of overloaded property WP_Post::$classes has no effect
- 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?
- 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
- Use menu class in walker function
- How do I separate link levels in a custom menu walker?
- 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?
- Get Menu Name inside walker
- WordPress Menu Walker: add #hashes to child page links (only)
- WordPress Walker – Group two items?
- Difference between walker class and basic php
- Where to implement custom walker class?
- custom walker class
- Custom navigation structure with walker class
- How do you add a around the second level of a Menu?
- How to add class to parent a tag with a sub menu
- Walker Class – Check if menu item has description and if so add class to li
- Help with walker for nav
- Dynamic_sidebar inside wp_nav_menu
- How to add attribute in menu code
- How to remove dropdown from wp_nav_menu
- Why is only the first operation run in my loop – except for on the last repeat? [closed]
- How Do I Add Images To Main Navigation Menu
- Walker menu not displaying at all
- How to add a element with walker menu right after begin of the navigation tags?
- WordPress Nav Walker – Top menu link with dropdown link not clickable (dropdown opens)
- Displaying Nav Menu
- Add custom class to li element which has children
- Custom menu walker – remove li tag based on class name
- 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?
- Adding a tag to wp_nav_menu
- changing the labels inside appearance -> menus for some for the fields
- Walker_Nav_Menu creating too many closing tags?
- Hook or callback when wp_nav_menu() has completed
- Help with WordPress Custom Nav Walker
- Why is my navigation in my onepage not working?
- WordPress menu walker – help to add custom class for each submenu
- Need help with Walker_Nav_Menu class
- why are my walker menu is showing like this?
- What is inside in $item in start_el function in Walker_Nav_Menu class
- Does the Default theme of WordPress like 2016, 2017 and 2019 uses Walker_Nav_Menu Class
- Where to place a svg chevron down in my custom walker?
- Add active class to wp_nav_menu
- Output existing wp_nav_menu with a custom walker
- how to split vertical menu into two columns using walker nav menu
- Classes CSS (Optional) – how do I reference this in php?
- Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items
- Custom menu with Walker class – what should the $db_fields be?
- 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
- How can I edit submenu headings using wp_nav_menu walker?
- Can’t add optional class to menu item when using Walker_Nav_Menu
- 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?
- Determine if a navigation item has children
- wp_nav_menu – Collapse with PHP
- custom walker to add iconfont to wp_nav_menu
- how to make a walker to this (in bootstrap, i try but not work)
- Custom navigation / menu output (walker?)