show search icon in nav menu, when clicked/toggle show search field - Wordpress
<p>I'm trying to add a search icon to my navbar on wordpress using wpresidence theme on Wordpress, </p>

<p>Once clicked, i would like the search bar to appear, i wouldn't mind if it makes use of the current advanced search feature.</p>

<p>Would be very grateful for your help</p>

<pre><code>function add_last_nav_item($items, $args) {
  if ($args-&gt;menu == 'header_menu') {
        $homelink = get_search_form();
        $items = $items;
        $items .= '&lt;li&gt;'.$homelink.'&lt;/li&gt;';
        return $items;
  }
  return $items;
}
add_filter( 'wp_nav_menu_items', 'add_last_nav_item', 10, 2 );
</code></pre>

<p>--- i've tried using bobsearch plugin and it didn't work and also entered this into my functions.php code but it didnt work</p>