SOLVED: Search Results Template with post type condition overrides Single Template on singular views

Browser: Chrome 151
OS: Windows 11

Hi,

I would like to report a critical template condition regression in 2.4 Beta 3.

When building complex websites, each post type naturally requires a dedicated Search Results Template with a tailored UI layout. Products / Posts (Blog) / Pages / Custom Post Types…

To achieve post-type-specific search templates in Bricks, the standard configuration is combining conditions:

  1. Search Results (or Template Type: Search Results)
  2. Post Type == [Target Post Type] (e.g., Product, Post, or Custom Post Type)

Our Single Product template has the Condition:

  • Post Type = Product

In 2.4 Beta 3, having a Search Results template with Post Type = Product causes Bricks to completely hijack the Single Product page and render the Search Results template instead of the Single Product template.

Thanks

:bear:

Hi @datgausaigon

Thanks for reporting this. We confirmed that a Search Results template containing a matching Post type condition could incorrectly override the Single template on singular views.

We will address this so that Search Results templates are only considered on actual search-result requests and when previewing a search template.

Please note that combining:

  • Search Results
  • Post type: Product/Post/CPT

does not create a post-type-specific Search Results template. Bricks template conditions are independent matching scopes. The Post type condition targets singular entries of that post type and does not inspect the post_type parameter of a search query.

WordPress also provides one native search-template context rather than separate search-template hierarchies per post type. A search may be restricted to products using post_type=product, but that does not select a different Search Results template. It will use the product archive template/shop template.

After the fix:

  • Singular products use the matching Single Product template.
  • Search requests use the matching Search Results template.
  • Different Search Results layouts per searched post type still require a custom implementation and not supported in Bricks.

This behavior was also present in earlier Bricks versions, so it was not introduced in 2.4 Beta 3. (I updated your forum thread version)

Regards,
Jenn

1 Like

We’ve addressed this in Bricks 2.3.12, now available as a one-click update in your WordPress Dashboard.

Search Results templates no longer override matching Single templates on singular views; separate Search Results layouts per searched post type remain unsupported.

Please read the changelog entry before updating, and let us know if you experience any issues.