Archived topic
Adding search bar to secondary navigation.
9 replies · Started by Jordan on January 13, 2021
Trying to add the search box to my secondary nav using a snippet I found on another post but for some reason the icon hasn't moved, but the search bar appears in the secondary location
https://bayoubutlersauces.com/bayou-butler-sauces/
I used the code below:
add_action( 'wp', function() {
if ( 'enable' === generate_get_option( 'nav_search' ) ) {
remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' );
add_action( 'generate_secondary_menu_bar_items', 'generate_do_navigation_search_button' );
remove_action( 'generate_inside_navigation', 'generate_navigation_search' );
add_action( 'generate_inside_secondary_navigation', 'generate_navigation_search' );
}
}, 20 );
Hi there,
where did you add the Code ?
Child theme! functions.php
Can you provide a link to your site?
Is it activated in the customizer under the primary navigation?
Yes. Its activated, and it works. But if you try it, you click the search icon and the bar actually appears over the secondary icons in the top right, so it’s like it’s partially working.
Can you disable the CSS in your child theme to test first?
Let me know :)
Yup. Just disabled it. Very minimal css happening so far. Same result.
Can you try switching from Float to Flex in Customizer > General?
It should work better :)
Oh awesome! Yup that worked. I didn't realize that flex feature was there. Love it!
Glad to hear :)