Site logo

Archived topic

The search engine shows me the products as blog entries and not as a shop

7 replies · Started by Gisbert A. on August 12, 2019

Viewing posts 1–8 of 8

hello, The search engine of my page shows me the products as blog entries and not as a shop.

When I use another template I do well, but when one search engine in the generatepress template, it shows me listings of products one below the other as if they were entries.

I am using generatepress PREMIUM, ELEMENTOR PRO and WOOCOMERCE

Can you be more specific?
There are many. If you know what it is I would appreciate it very much if you can tell me the name or even put a direct link to which is.

Thank you for your help.

Okay, thanks. I guess this'll figure it out.

One last question, do I put it directly in the search.php file of your template or does it go in another file?

Is it just copy and paste? or does it have to go somewhere?

thank you

Thank you very much for your help, it's already solved.

Copy the code:

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' )
);
} );

into the functions.php file and it already works.

Glad to be of help

This archived topic is closed to new replies.