Relevanssi doesn’t change your theme’s search results template; Relevanssi has no such power. In Woodmart, like many other WooCommerce themes, the search results template used depends on the post_type
parameter. If the post_type
is set to product
, you’ll get the product template; otherwise, you’ll get the basic blog post template.
So, what changes or removes the post_type
parameter? Relevanssi in itself does not touch the parameter.
Thread Starter
jkont
(@jkont)
Hi.
Thank you for your reply (really fast) !
Yes, all the parameters are correct. The search type has been set to “product” , it was alway like this.
But , only when I deactivate Relecanssi , I have the search results with the product type layout. If I enable your plugin the results will become blog type.
Maybe a Woodmart malfunction???
Unfortunately , my Woodmart support period has been over , so I can’t post the issue in their support forum.
Regards
Try forcing the post type, add this to your theme functions.php or in a code snippet:
add_filter( 'relevanssi_modify_wp_query', function( $query ) {
$query->set( 'post_type', 'product' );
return $query;
} );
Does that help?
Thread Starter
jkont
(@jkont)
Yes , that did it !!!
A few days ago , the issue didn’t exist , so the snippet was not essential.
Maybe Woodmarts last update has a compatibility issue (?) and I would prefer everything work well without the help of snippets, but you did the best.
Anyway , I thank you VERY MUCH !!!
What a fast reply !!!
You have the best support I have ever seen and you absolutely deserve the 5 star rating !!!
Best regards
It may be Woodmart, it may be something else; you can get rid of the snippet if you can figure out what it is that overrides the post_type
parameter. It’s something in your site, maybe in your theme functions.php.