- This topic has 7 replies, 3 voices, and was last updated 4 years, 10 months ago by
Elvin.
-
AuthorPosts
-
May 20, 2021 at 3:49 am #1790973
Artur
Don’t see add to basket button and price.
May 20, 2021 at 5:54 am #1791111David
StaffCustomer SupportHi there,
are you using the Navigation Search ?
If so the snippet here will change its behaviour to display product search results:https://docs.generatepress.com/article/generate_navigation_search_output/#woocommerce-products
May 20, 2021 at 8:18 am #1791480Artur
yes I use navigation search how to fix it
May 20, 2021 at 8:20 am #1791482David
StaffCustomer SupportIn this link:
https://docs.generatepress.com/article/generate_navigation_search_output/#woocommerce-products
Under Woocommerce Products – add that PHP Snippet to your site.
This doc explains how to add PHP:May 20, 2021 at 8:25 am #1791492Artur
I use this
add_filter (‘generation_navigation_search_output’, function () {
printf (
‘<form method = “get” class = “search-form navigation-search” action = “% 1 $ s”>
<input type = “search” class = “szukaj -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’, ‘generatedpress’)
);
});May 20, 2021 at 8:26 am #1791494Artur
but not working https://meblowykramik.pl
May 20, 2021 at 9:55 pm #1792060Artur
David have some problem with that
https://docs.generatepress.com/article/generate_navigation_search_output/#woocommerce-products
1. Place holder
When I add that code need 2 click to enter text. Without that 1 click.
add_filter( ‘generate_navigation_search_output’, function() {
printf(
‘<form method=”get” class=”search-form navigation-search” action=”%1$s”>
<input type=”search” placeholder=”Enter your search” class=”search-field” value=”%2$s” name=”s” title=”%3$s” />
</form>’,
esc_url( home_url( ‘/’ ) ),
esc_attr( get_search_query() ),
esc_attr_x( ‘Search’, ‘label’, ‘generatepress’ )
);
} );May 20, 2021 at 10:11 pm #1792066Elvin
StaffCustomer SupportHi there,
Have you added multiple snippets of the same
generate_navigation_search_outputfilter?Last time I checked I saw your site is rendering multiple search forms.
Do you want the search function to search WooCommerce product AND have the search bar get a placeholder text?
If so, we can rewrite the code coming from that documentation into a single filter.
Example:
add_filter( 'generate_navigation_search_output', function() { return sprintf( '<form method="get" class="search-form navigation-search" action="%1$s"> <input type="search" placeholder="Enter your 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' ) ); } );This is how it will behave – https://share.getcloudapp.com/WnuYL8K7
-
AuthorPosts
- You must be logged in to reply to this topic.