-
Hi, this is an extension to the “secondary theme menu” we discussed in issue https://generate.support/topic/secondary-theme-mobile-menu/.
I’ve almost got everything the way I want. Taking your advice, when I’m on a page that uses the secondary theme, I swap the menu out using the
wp_nav_menu_args
hook. That allows me to re-use the setup as displayed on my primary theme menu. However…The primary menu includes the search icon, which we don’t want displayed in the secondary theme menu. Is there a way I can programmatically remove the search icon, which I would do from the same chunk of code that swaps the menu out?
-
I tried removing the hooks as shown in https://docs.generatepress.com/article/navigation-search/, but it had no effect.
-
Hi Scott,
Can I see the site in question?
And as this question is related to GP Premium, can you also add GP support key to your profile?
-
Not all pages display the menu, but you can view it at https://dev.acornfinance.dev/contractors-new-design/. Note that the icon has been hidden with CSS right at the moment. And that link displays two menu bars, the top one is the “real” one. Admin login below.
-
Support key added.
-
The code I’ve been using to remove the search icon is:
remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' ); remove_action( 'generate_inside_navigation', 'generate_navigation_search' );
I’ve tried executing it from the ‘wp’ hook as well as the ‘init’ hook.
-
Fernando
Hi Scott,
If you want to remove it for all pages, try disabling it from Appearance > Customize > Layout > Primary Navigation. Or, are you wanting to remove it for specific pages only?
-
Specific pages only.
-
Fernando
Which specific pages for instance?
-
The one I listed above: https://dev.acornfinance.dev/contractors-new-design/
-
Fernando
Can you try this?:
add_action( 'wp', function() { if ( 'enable' === generate_get_option( 'nav_search' ) && is_page( 240631 ) ) { remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' ); remove_action( 'generate_inside_navigation', 'generate_navigation_search' ); } }, 20 );
-
That worked, thanks!
-
Fernando
You’re welcome, Scott!
- You must be logged in to reply to this topic.