When your website means business.

Nav Menu, Search | Type: PHPAdd search form to specific nav menu

add_filter('wp_nav_menu_items', 'add_search_form', 10, 2);
function add_search_form($items, $args) {
    if( $args->theme_location == 'MENU-NAME' )
    $items .= '<ul>
        <li class="search">
        <form id="searchform" role="search" action="'.home_url( '/' ).'" method="get"><input id="s" name="s" type="text" value="search"><input id="searchsubmit" type="submit" value="'. esc_attr__('Search') .'"></form>
return $items; }

Reference Links

We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Cookies Notice