Site logo

Archived topic

Enable Search on Secondary Navigation

3 replies · Started by Rick on July 25, 2018

Viewing posts 1–4 of 4

I am designing a site where I use either the Primary Navigation or the Secondary Navigation depending on the page. I would like to have search enabled for both, but GP only enables search for the Primary Navigation. Is there a code snippet somewhere that I can use for this feature?

Thanks!
-Rick

Hey Rick,

It's not really built to work in two different places at once, but if it's possible, you'd use this function: https://docs.generatepress.com/article/navigation-search/#use-navigation-search-in-secondary-navigation

However, you'd need to remove these lines:

remove_action( 'generate_inside_navigation', 'generate_navigation_search' );
remove_action( 'generate_inside_navigation', 'generate_mobile_menu_search_icon' );
remove_filter( 'wp_nav_menu_items', 'generate_menu_search_icon', 10, 2 );

Thanks Tom! I appreciate the quick response!

You're welcome :)

This archived topic is closed to new replies.