- This topic has 9 replies, 2 voices, and was last updated 4 years, 3 months ago by
David.
-
AuthorPosts
-
March 11, 2022 at 8:15 am #2150963
Stephen
http://www.stephenlavender.site
I’ve turned on navigation search in primary navigation layout options and the search icon is always on its own line in the navigation menu.
I understand as the navigation menu re sizes it can use another line but the search icon is always on a new line by itself– Can I get the search icon on the same line as the rest of the menu?
Thanks
StephenMarch 11, 2022 at 8:34 am #2150983David
StaffCustomer SupportHi there,
Try adding this PHP Snippet to your site:
add_action( 'wp', function() { remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' ); }, 500 ); add_filter( 'wp_nav_menu_items', function( $nav, $args ) { if ( 'enable' !== generate_get_option( 'nav_search' ) ) { return $nav; } if ( isset( $args->theme_location ) && 'primary' === $args->theme_location ) { $search_item = apply_filters( 'generate_navigation_search_menu_item_output', sprintf( '<li class="search-item menu-item-align-right"><a aria-label="%1$s" href="#">%2$s</a></li>', esc_attr__( 'Open Search Bar', 'generatepress' ), generate_get_svg_icon( 'search', true ) ) ); return $nav . $search_item; } return $nav; }, 10, 2 );How to Add PHP: https://docs.generatepress.com/article/adding-php/
March 11, 2022 at 8:43 am #2150992Stephen
great thanks, works perfectly as always.
Now though I dont have a search icon on mobile screen sizes
– can I get the search icon back on my mobile screen size header ?
Thanks
StephenMarch 11, 2022 at 8:55 am #2151004David
StaffCustomer SupportRemove this part of the snippet:
add_action( 'wp', function() { remove_action( 'generate_menu_bar_items', 'generate_do_navigation_search_button' ); }, 500 );It should now show 2x on Desktop, if it does let us know and ill provide the CSS to remove the duplicate
March 11, 2022 at 9:05 am #2151012Stephen
Hi, yes thats right there is 2 search icons now, 1 inline with the menu and one on a new line in desktop
March 11, 2022 at 9:13 am #2151018David
StaffCustomer SupportAdd this CSS:
@media(min-width: 850px) { .main-navigation .menu-bar-item.search-item { display: none; } }March 11, 2022 at 9:20 am #2151028Stephen
thats great thanks
In the mobile header the search icon is grey and a bit small.
– Can I make the search icon white and make it bigger for mobile screen size ?
Thanks
StephenMarch 11, 2022 at 9:29 am #2151046David
StaffCustomer SupportTry this:
#mobile-header .menu-bar-items a { color: #fff; font-size: 20px; }March 11, 2022 at 9:43 am #2151066Stephen
thats perfect, thank you
March 11, 2022 at 9:50 am #2151079David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.