- This topic has 9 replies, 2 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
January 16, 2023 at 7:58 am #2497658
WPguy
Hi,
I’ve tried using the solutions given on this forum to reduce the search box and align it to the right, but the given CSS didn’t work for me.
Can you help out?
Screenshot attached.
Thanks!
January 16, 2023 at 8:57 am #2497737David
StaffCustomer SupportHi there,
try adding this CSS:
nav .navigation-search.nav-search-active { max-width: 400px; left: unset; }January 16, 2023 at 9:14 am #2497756WPguy
Thanks, David!
Just one more thing:
1) how can I add border color and radius?
2) Is there any chance to add a prefilled text into the search box?
Thanks!
January 16, 2023 at 9:23 am #2497765David
StaffCustomer SupportColors can be set in the Customizer > Colors.
But as you’re going to need some CSS for the other styles you can do it all there.Quick question, apart from adding the placeholder text, any other changes eg. a submit button. As the former will require some PHP so its easier to handle it all in one go 🙂
January 16, 2023 at 9:29 am #2497771WPguy
Hey David,
1) Customizer > Colors. I could only find background and text color options for the search box there. So would be great to know the CSS for the borders.
2) Nope, no submit button is needed, just the placeholder text.
Thanks, David!
January 16, 2023 at 9:51 am #2497802David
StaffCustomer Support1. Replace my other CSS with:
nav.main-navigation .navigation-search { max-width: 400px; left: unset; right: -10px !important; margin-top: auto; border-radius: 100px; border: 3px solid #000; height: 50px; top: 5px; overflow: hidden; } nav .navigation-search input[type="search"] { height: 45px; padding: 2px 20px; } .main-navigation .menu-bar-item.close-search a { background-color: transparent !important; }2. For the placeholder text you need this PHP Snippet:
add_filter( 'generate_search_placeholder', function() { return 'Search'; } );January 16, 2023 at 10:14 am #2497818WPguy
Thanks, Dave!
1) Done!
2) Paste the snippet (I use the code snippets plugin) but no text comes up in the search box. Image attached.
January 16, 2023 at 10:23 am #2497834David
StaffCustomer SupportSorry my bad – you need this snippet:
https://docs.generatepress.com/article/generate_navigation_search_output/#add-a-placeholder
January 16, 2023 at 10:58 am #2497878WPguy
Awesome! Thanks Dave!
January 17, 2023 at 3:27 am #2498625David
StaffCustomer SupportYou’re welcome!
-
AuthorPosts
- You must be logged in to reply to this topic.