Layout builder - add custom search result archive

Hi!

I read this Customizing search results page

I need to change the layout of my reach result page so that it looks like my SHOP ARCHIVE page. I can’t find search results under conditions. Please help.

Hello @Lobsterass,

Thanks for writing to us.

Please note search result page is a default archive page, as per your given screenshot it seems that you are using the “WC Archive” layout template. You need to use the “Archive” layout template for the Search Result archive layout.

Hope it helps
Thanks

1 Like

Awesome! Works! Hey, is there a way edit the number of search results per page? https://witrapublishinggroup.com/literature/

Hello @Lobsterass,

In case you want to limit the search result page posts to be displayed per page then you need to go to WordPress Dashboard —>Settings —>Reading —> Blog pages show at most. Set the number of posts that you want to display.

The given page URL is a Shop page in case you want to set the number of products to be displayed per page I would suggest you go to the Theme Options —>WooCommerce–>Posts Per Page
Theme-Options-Pro

Hope it helps
Thanks

1 Like

Perfect! One last thing, how do I make only products show up as search results? I have products and blog posts comingled now. I’m using {{dc:post:title}}

Hi @Lobsterass,

You need to customize the code a bit to set the search only for the Products. I would suggest you go through the following thread on a similar topic.


If you are not proficient in this, I would suggest you hire a developer who can assist you to do the customization or you can avail of our newly launched service called One, where we answer the questions beyond normal theme support.

Thanks

1 Like

Ok, well I take it I got to call on products in child’s funtions.php then. Could you tell me why this doesn’t work?

function JustProductFilter($query){
	if ($query->is_search && !current_user_can('administrator') ){
		$query->set('post_type', 'product');
	}
	return $query;
}
add_filter('pre_get_posts','JustProductFilter');

Hello @Lobsterass,

The code will work if you are not logged in as an Administrator. Removing the && !current_user_can('administrator') should make it work even if you are logged in as an Admin.

Be advised that custom coding is beyond the scope of our support under our Support Policy. You will be the one to maintain the code. If you are unfamiliar with code and resolving potential conflicts, you may select our One service for further assistance.

Best Regards.

1 Like

Awesome! Works! Thanx! <3

Hello @Lobsterass,

Glad that we were able to help you. Please feel free to reach us if you have any more concerns.

Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.