Hey y’all! I’m setting up my first WooCommerce site and I was hoping to find a way to present search results differently for products than regular posts/pages. Think image tiles for products and a list of text titles for all other content.
There is also a matter of filters…I was thinking about then being able to filter by content type (products, pages, posts, etc.)
I have products, pages, posts, and a couple of CPTs (already edited my functions to search all) and I am hoping that someone much smarter than me has figured out an elegant solution.
I would really appreciate any help you have to offer. Thanks!
*Sorry…still new to Bricks. Here’s my stack in case it helps: Bricks, ACSS, BricksUltimate, BricksForge.
Thanks for the great response! I’ve tried creating two search results templates, one for products and a general search result template for everything else…each with conditions and query loops to show the respective content type.
No matter what I try with the conditions, my search results seem to default to my product search template…unless I put that page template into Draft, then it faults to the general search result template. Wondering what I’m doing wrong.
Product search template conditions:
General search result template conditions:
As much as I would like all content to show up on a single page, I would rather use content specific search results is to filter results in the context of the content type. Eg- product search results gets product related filters, whereas regular content gets regular filters, etc.
I’ve also tried the following with no luck…
Product search template conditions:
General search result template conditions:
Ok. I’ve never done this so this may be wrong… but when testing it I created one search result page - no template conditions.
Search results page: I created a section, and dropped a post loop in.
Created section Two and dropped a product loop in.
Made a page with 2 search forms.
On the search form for posts I added a parameter of post_type = posts
On the search for products, post_type = products
Then for the sections I set conditions of url param:post_type = posts (or products)
It works and shows posts when I use the post search, product when i use product search.
Like I said, i was curious so I just tried to build what you describe, and this works. Others may know better.
1 Like
Thanks for taking a stab at it! It seems to work but, it’s taking me to my search template, instead of my post-type specific templates. I guess I’m going to have to tinker with it to get the filters and results to show up conditionally. Thanks for setting me down the right path