回覆。 在MenuBar WordPress中搜索

I am trying to put my woocommerce product search widget inside the Menu. Can someone show me the right way of doing this.

here is my code 1st

if (function_exists('register_sidebar')) {
register_sidebar(array(
  'id' => 'search-widget',
  'name' => __('Search Widget'),
  'description' => __('Drag search widget to this container'),
  'before_widget' => '<article id="%1$s" class="widget %2$s">',
  'after_widget' => '</article>',
  'before_title' => '<h6>',
  'after_title' => '</h6>'      
  ));
}

then I want to put this widget inside the Menubar.

    function include_search_box($items, $args) {
        // only display search box on our primary menu
        if( 'primary' === $args -> theme_location )
    $items .= '<li dynamic_sidebar("search-widget")>' . '</li>';
    return $items;
    }
add_filter( 'wp_nav_menu_items', 'include_search_box', 10, 2 );

My problem is the search Box doesn't appear. How can i insert the widget with my current menu where in it will not affect all the items inside My Menu.

Thank you