title: How to add the search bar to mobile menu in wordpress?
body: <p>I've added this code to my functions.php file:</p>
  
  <pre><code>function wpgood_nav_search( $items, $args ) {
  $items .= '&lt;li&gt;' . get_search_form( false ) . '&lt;/li&gt;';
  return $items;
  }
  add_filter( 'wp_nav_menu_items','wpgood_nav_search', 10, 2 );
  </code></pre>
  
  <p>I've found it here:
  <a href="https://stackoverflow.com/questions/31822842/adding-search-bar-to-the-nav-menu-in-wordpress">adding search bar to the nav menu in wordpress</a></p>
  
  <p>The problem: this code adds the search bar to desktop and mobile menus, but I need to add the search bar <strong>only to my mobile menu</strong>, because the desktop version of my site already has a search widget in the left sidebar. </p>
  
  <p>How can I do this? Please, help me. Thanks!</p>
  
  <p>Initializiation of my menus in functions.php :</p>
  
  <pre><code>// Initialize navigation menus
  register_nav_menus(
      array(
          'primary-menu' =&gt; esc_html__( 'Primary Menu', 'bento' ),
          'footer-menu' =&gt; esc_html__( 'Footer Menu', 'bento' ),
      )
  );
  </code></pre>
  
  <p><strong><em>Thank you so much for your help! Finally I have decided to use my initial code and edit the searchbar's position and style with css, because I am not so good in coding:)</em></strong></p>