- This topic has 15 replies, 2 voices, and was last updated 3 years, 11 months ago by
Leo.
-
AuthorPosts
-
June 10, 2019 at 11:06 am #925143
Sam
Hi I can see some threads about changing the background color and color of the nav bar search field and it is all done seemingly with css. I was wondering is there no option in the customizer for this?
thanks
SamJune 10, 2019 at 11:11 am #925145Leo
StaffCustomer SupportHi there,
Currently not. I don’t believe this comes up very often but will definitely mention to our group to see if it’s option-worthy.
Let me know if you need help with the CSS in the meantime ๐
June 11, 2019 at 12:57 am #925536Sam
Hi OK noted I’ll adjust with CSS for now.
Also, while testing, I noticed something odd with the search form in the header. If you do a search, when the results page loads, it does not clear the search field. So if you were to then do a second search and just start typing it would be a mess as it would include the string from your previous search. You would have to manually delete your first search to do a second, which is a bad UX. Is this supposed to be the case or has it been overlooked? is there a way of making this form clear when the page is reloaded / search performed?
thanks
SamJune 11, 2019 at 8:56 am #926098Leo
StaffCustomer SupportGive this a shot:
https://generatepress.com/forums/topic/search-box-clear/#post-574769June 11, 2019 at 9:00 am #926100Sam
Hi thanks but that snippet does not work…
June 11, 2019 at 9:16 am #926121Leo
StaffCustomer SupportJust tested and it worked perfectly for me:
https://www.screencast.com/t/xbtvMlRq0PCan you make sure all caching is cleared and disabled?
June 11, 2019 at 11:32 am #926229Sam
Hi Leo, I am not using any cache plugins.
June 11, 2019 at 11:41 am #926238Leo
StaffCustomer SupportHow are you adding the code?
In order to further debug, we will need to see the issue live.
June 11, 2019 at 11:48 am #926244Sam
Hi sorry I am using a Mamp local server for development I know it is not ideal for debugging. I am adding the snippet with the Snippets plugin as you guys recommend.
See hear a screen cast: https://www.dropbox.com/s/en4676ypl08phwx/clear-search.mov?dl=0
June 11, 2019 at 11:53 am #926248Leo
StaffCustomer SupportSorry but it’s not really possible to debug with screen capture – my screen capture is showing that it’s working but that doesn’t help you either.
Thanks for your understanding ๐
June 11, 2019 at 11:56 am #926251Sam
What are you be looking to check, maybe I can advise from here?
June 11, 2019 at 12:01 pm #926260Leo
StaffCustomer SupportI’m not sure yet unfortunately.
Did a little more research and the same code worked for someone else as well so there must be something specific to your install:
https://generatepress.com/forums/topic/navigation-logo-problem/page/2/#post-882684June 12, 2019 at 8:02 am #927159Sam
Hi Leo, ok I worked out why it is not working, but it throws up another issue to solve : (
I am using also the below snippet provided on this forum, that makes the search form only search products (which I need). With this disabled, the clear form snippet works. So the question is, how do we make both snippets work with each other? Could they be combined?
add_filter( ‘generate_navigation_search_output’, function() {
printf(
‘<form method=”get” class=”search-form navigation-search” action=”%1$s”>
<input type=”search” class=”search-field” value=”%2$s” name=”s” title=”%3$s” />
<input type=”hidden” name=”post_type” value=”product” />
</form>’,
esc_url( home_url( ‘/’ ) ),
esc_attr( get_search_query() ),
esc_attr_x( ‘Search’, ‘label’, ‘generatepress’ )
);
} );thanks
SamJune 12, 2019 at 9:49 am #927260Leo
StaffCustomer SupportYup that explains it.
Try this:
add_filter( 'generate_navigation_search_output', 'tu_remove_search_query' ); function tu_remove_search_query() { printf( // WPCS: XSS ok, sanitization ok. '<form method="get" class="search-form navigation-search" action="%1$s"> <input type="search" class="search-field" value="" name="s" title="%2$s" /> <input type="hidden" name="post_type" value="product" /> </form>', esc_url( home_url( '/' ) ), esc_attr_x( 'Search', 'label', 'generatepress' ) ); }
June 12, 2019 at 9:56 am #927272Sam
Awesome! that did it. Thanks so much Leo.
-
AuthorPosts
- You must be logged in to reply to this topic.