NO BUG: Search Template Issues - Template Fields like Featured Image getting Overwritten by Query on Page

This issue happens in Bricks 1.7 but also previous versions as well.

I have a search template which pulls in a section template for the Hero (using the template widget).

This section template uses the Featured Image, Title, and Excerpt fields of the post. This Hero works fine on Pages and Posts.

It also works fine for the Search Template in the Bricks Builder (I added an Excerpt custom field to the bricks template post type as well) but it does not work in the front end as it looks like a page title for a page that is returned in the search results gets set as the post title for the current page.

I have disabled merge query in the query loop of the search results and that has not fixed it.

Why is this working in the Bricks Builder but not in the front end?

This looks to be a merge query issue (as the section template within the search template is pulling the search results post data instead of the data from the fields that belong to the actual template )

Hi Tom,
Thanks so much for your report!

It is important to distinguish where it does not work properly. When you look at the template preview, or when you are actually on the search results page?

In the latter case, everything is fine for me :thinking:

Best regards,
timmse

Never checked the preview page from the Bricks Builder Editor. Just did and that works fine as well

So it works fine in the Bricks Editor and Preview, but not on the actual search results page.

Would you be so kind as to send temporary login credentials and a link to this thread to help@bricksbuilder.io using the email address you used during the purchase?

After some more testing this also happens on other template types as well like Archive. I enable disable merge query and the hero still pulls data from the query of posts and not the data from the template itself.

Would you be so kind as to send temporary login credentials

Yup.

Hey Tom,
Thanks so much for the login credentials!

The issue will be fixed with Bricks 1.7.1 :v:

Best regards,
timmse

1 Like

Hi Tom,
Weā€™ve fixed this bug in Bricks 1.7.1, now available as a one-click update in your WordPress Dashboard.

Please let us know if you are still experiencing issues.

Best regards,
timmse

1 Like

Yup it is now working. Thanks for your teams hardwork!

This bug is back with the release of Bricks 1.7.2.

Most likely related to this issue which was fixed in Bricks 1.7.2

Hey Tom,
Thanks for letting me know.

Can you send me access data and a link to this thread again so that I can take a closer look at the setup? Itā€™s clearly been too long agoā€¦ :smiley:

2 Likes

Hi

I have the same problem with 1.7.2.

With 1.7.2 my search results page does not activate or send the data to the WPGridbuilder facets, the facets all stay grayed-out, canā€™t be selected and the buttons (like Choice) show instead of being hidden:

I went back to 1.7.1 and the search results page does render properly with the WPGridbuilder facets:

Something is wrong with 1.7.2.

Cheers

Patric

Hi

My problem is solved with todayā€˜s update file from WPGridbuilder 1.1.1.

It was not a Bricks problem.

Best wishes

Patric

1 Like

@timmse This problem is not solved, I am not sure why it got switched back to solve (it was on wait before I believe). Patric issue is not the same as the main problem described in the first post.

Did you get my DM with my site details so you can log in and check it further.

Hi @Tom ,

I have checked your website setup.
You did a very creative setup, which used {featured_image} , {post_title} and {post_excerpt} to output in the Search Template CPT by bricks. (Post Id 1193)

However, this will not work on the actual frontend. The search templateā€™s image, excerpt, or title (1193) will never be used in the frontend. Bricks will only use its bricks content to render the layout based on your design.

When you are using {post_title} inside a Search template, the first post resultā€™s title will by rendered. Same to {featured_image} and all post-related dynamic tags. Instead of the Search Templateā€™s data.

Thatā€™s why when you search for ā€œtestā€, the hero section shows the first post information.

I would suggest you remove the general Hero template and replace it with hardcoded data (text + image) which you defined on the template (1193)
Yeap, itā€™s hardcoded data but those data were just meant for the search template, am I right?
image

Alternatively, inside your Section - Hero Default template, add another set of Featured Image, Heading, Lede and using condition {echo:is_search} == true to target whether current is inside Search page.
image

Hope this explanation makes sense.
(It was working in 1.7.1 as that was a mistake and itā€™s a bug when we generated the post Id behind the code)

Regards,
Jenn

Thanks for your detailed explanation and that is initially how I had it setup.

The problem with that approach is it is not very maintainable. Iā€™ve had to change the structure of the hero before which means I have to go through all the templates that use it and make the same changes and try not to make any mistakes.

I have it setup the same way for archive templates as well which also have the same problem as the search template. Is this just for search templates or is this an issue for all template types that also have a query on the page?

Also Isnā€™t this what the disable merge query switch on the query suppose to solve? Does the template itself (or the template the page/post uses) also need a disable merge query? I assume this is what is happening in the Bricks editor since my approach works in it.

@timmse @itchycode

Okay just installed Bricks v1.7.3 . No mention of this issue in the changelog so I wasnā€™t expecting any fixes but I want to see where this issue stands as it initially had all been fixed in Bricks 1.7.1.

I use the template widget to pull in a section template for my hero which uses post data like {featured_image} , {post_title} and {post_excerpt} . Doing it this way makes it extremely easy to modify the layout once and have it update wherever it is used.

In the Bricks Editor all examples below work fine.

On the front end of Bricks currently the following works:

  • Single Template for Pages
  • Single Template for Posts (fairly sure it works but have not tested it in new version)
  • Single Template for CPT
  • Archive Template for Taxonomy (itā€™s weird that this works but not for a CPT archive)

On the front end of Bricks currently the following DOES NOT work:

  • Archive Template for Custom Post Type (CPT)
  • Search Template (from my understanding above this may not be possible but it WAS working before)

So is the issue in the queue to get fixed or are you waiting for any more information from me?

Thanks

Hi @Tom ,

I am sorry to say this is not a bug.
{post_title}, {post_excerpt} or {featured_image} will never show ā€œbricks_templateā€ post type data in actual frontend.

Example:

  • Single Template for Pages
    {post_title} in the frontend will be the page title

  • Single Template for Posts
    {post_title} in the frontend will be the post title

  • Single Template for CPT
    {post_title} in the frontend will be the post title

  • Archive Template for Taxonomy
    {post_title} will be the first result postā€™s title of the current taxonomy page. If you are talking about your ā€œCoursesā€ archive template, it is working because you are using the hardcode method, not {post_title}


    (suggest use {archive_title})

  • Archive Template for Custom Post Type
    {post_title} will be the first result postā€™s title of the current archive page
    (suggest use {archive_title})

  • Search template
    {post_title} will be the first result postā€™s title of the current search term
    (suggest use hardcode text)

Hope the explanation above and my suggestions make sense.

Regards,
Jenn

Yup your suggestions make sense though it does make things less maintainable in the future. Sorry about the taxonomy archive, I didnā€™t realize it was still on the original way of doing it.

Why does my way work in the editor then? If this doesnā€™t/canā€™t work in the front end then the Bricks Editor should mimic the front end behavior. When it doesnā€™t it creates confusion and makes it look like a bug.

If not technically a bug could this be a feature request then?

Also I just thought of another way to do it which in part is how I had the Excerpt working in templates currently.

I create a separate custom field group and assigned them to the bricks templates CPT which has fields for the heading, image and excerpt. I could then pull this data instead of the post_title in my hero section template.

As you see I tried this with just the Excerpt field on the current site and the data for the template is not being pulledā€¦ Isnā€™t this a bug? (or is it a feature request)