Ive added a search bar to my navigation menu by placing this in my functions.php:
add_filter('wp_nav_menu_items','add_search_box', 10, 2);
function add_search_box($items, $args) {
ob_start();
get_search_form();
$searchform = ob_get_contents();
ob_end_clean();
$items .= '
<li>' . $searchform . '</li>
';
return $items;
}
[Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]
The problem is that i have two menus on my site, and the search box shows up on both menus. Is there a way to specify which menu? Ive searched google and most of this forum with no luck. Thanks.
My site is
GearMoose
i've deleted the code for now until i can find a solution.