0
votes

I'm making a site in wordpress and have a search form in my main menu, which I want. It's added from:

 * Add search box to nav menu
 */
function wpgood_nav_search( $items, $args ) {
    $items .= '<li>' . get_search_form( false ) . '</li>';
    return $items;
}
add_filter( 'wp_nav_menu_items','wpgood_nav_search', 10, 2 );

In the genesis sample child's theme functions.php

However I want to add another menus on other pages without the search form, but it seems that this code is adding the search form to every menu on my site. How do I change it so that it only affects the one menu?

1

1 Answers

0
votes

Check in the admin page (wp-admin) ,

Desgin > menus , then select your menu .. there is option to show or unshow the search bar for any menu

if not you have to customize your navwalker which is included in functions.php