bux23
11/26/2016 - 12:11 AM

WP add search to menu

WP add search to menu

//////////////////////////////////////////////////////////////
///////// ADD SEARCHFORM
//////////////////////////////////////////////////////////////
add_filter('wp_nav_menu_items','add_search_box_to_menu', 10, 2);
function add_search_box_to_menu( $items, $args ) {
    if( $args->theme_location == 'primary' )
        return $items.get_search_form();

    return $items;
}