WordPress.org

Support

Support » Themes and Templates » Adding search bar to menu

Adding search bar to menu

  • I am trying to add a search bar to the nav_menu, by adding this to the bottom of functions.php however it will not display.

    add_filter('wp_nav_menu_items','add_search', 10, 2);
    
    function add_search($items, $args)
    {
    
        if( $args->theme_location == 'primary' )
    
            return $items . '<li>'.get_search_form().'</li>';
    
    }

    Any ideas on way it seems to ignore this?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Adding search bar to menu’ is closed to new replies.