Template conditions are either failing or don't make sense

I admittedly come from the O2 builder having used it for many years and now trying to “get” how templates work in Bricks. I have read the Bricks docs but I am either not getting something or this is a bug. I am not sure this would be the expected behavior. I see this with 1.4.2 and 1.5B versions.

I set the status for my NAV bar to Header
I set the condition for a Template (Hero) Section to “Entire site”
Then I create a Content template and “Post type (Page)”.

The “Header”, which is set to “Entire Site” by default shows up even when I am editing the template set to “Section” (that is my Hero), but I don’t see it in the content Template when editing, but the NAV does show?

Can’t I set a specific condition for a Template set to “Section”?

Edit: I tried setting the NAV as a Header and then the condition default to “Entire Site”. Then I created a Hero as a Section and set the condition to be “Front Page” but the hero shows up on all pages.

Edit 2: Ok, I set the NAV to ‘Entire Site’ as a Header, set the Hero as a section and only for the condition as ‘Front Page’, the Content Template as ‘Post type (Page)’ with the type ‘Single’.

Now I get a Front page with the NAV and Hero but no content! The other pages have the NAV, no Hero and the ‘Content’ using the Content template ‘Single’ for the condition ‘Post type (Page)’.

Edit 3: Ok, I set the NAV to ‘Header’ and ‘Entire Site’ I set the Hero to ‘Single’ and ‘Post Type (Pages)’ I set the content to ‘Single’ and ‘Pages’ Now no Hero on any page.

I’m not liking Bricks right now. Something this simple should not be so difficult to do!

Is there a clear tutorial on just using templates and conditions without a lot of “fluff”?

I am not able to totally understand your question. Others will help you with it. Meanwhile there is an option to disable header while editing any templates in settings. There are also template exclusions which you can use to exclude the templates. Also take a look here. An Intro To Templates – Bricks Academy (bricksbuilder.io)

Yes I looked at the video more than once :stuck_out_tongue:

I’m not sure if turning off the defaults will help but I will try it :slight_smile:

Thanks for the reply to a ranting frustrated, but calming down Bricks user.

If I have the NAV set as a ‘Header’ and use the default “Entire Site”, Then create the Hero as a ‘Section’ and even if I say show on ‘Entire Site’, the hero is showing with the NAV and the Hero in the editor, but not when I render the page. Just the NAV header and the content from the Content Template set to Single → Post type (Page).

Makes no sense to me at all.

As I look at this issue, MAYBE I am thinking of the template concept more like an O2 user than a Bricks site builder.

If someone might be able to help me understand the “Bricks Workflow” better (I have watched: Bricks - Getting Started (Installation, Settings, Editing) - YouTube and it feels like “between the lines” of this video I may be looking at how to build the site with a different set of workflow concepts.

I’m not sure. The way I expect templates to work in Bricks may not be completely correct to how the thinking for templates and Bricks functions as a builder.

I look forward to understanding better.

Edit: Yeah, even doing it the way Thomas explains in this video, I still see the image I want to use as the Hero (featured or background image) in the editor and its’ preview, but not with the rendered page. meh

More info and this isn’t working the way I expected, but I have the desired result.

I have a template named NAV and it is assigned to entire site.
I have a template named HERO and it is assigned to section.
I have a template named CONTENT and it’s the content layout for pages - assigned to every page.
I have a template named FOOTER and it’s assigned to entire site.

Here is what doesn’t make sense and I don’t know what Bricks acts like this in 1.4.2 or 1.5B.
If I edit the page in Bricks, say my “Home” page, I can insert the HERO section and it shows up in the editor. If I use the “Eyecon”, it shows up in the preview, so I can see it in the Bricks editor and in the preview, but if I open the page in Gutenberg and preview it there, I only see the NAV and FOOTER.

So far the only way I can get it to show in the editor and the page is if I insert the HERO into the CONTENT template.

This is NOT an expected behavior.

I hope I have explained this better and pinpointed the issue more specifically.

Can anyone help me understand what is the expected behavior and why I can’t put the HERO at will where I want it?

Thanks!

Hi,

Well it is not that much clearer than your first message :wink:

So here’s a very important thing to consider if you come from O2 (like me): Bricks templates don’t work like O2 at all because (to my knowledge) they follow Wordpress native templating system.

So for me every layout is basically HEADER, MAIN (content), FOOTER.

Bricks section templates can be freely inserted INSIDE those 3 parts with the builder, but NOT OUTSIDE.
(You might use hooks to inject them wherever you need but it’s another subject.)

So you can’t expect some NAV/HERO/CONTENT/FOOTER to work like you want (like you may do with O2).

You’ll need to do something like this:

  • your nav bar inside a HEADER template (will be rendered as header / nav for instance)
  • your hero + page content inside CONTENT template (will be rendered as main / hero+section1+…)
  • your footer content inside a FOOTER template (footer / section1…)

Note that if you need to inject Gutenberg or Bricks content, you have to use the template element and choose either WP or Bricks.
This is the equivalent of Inner content element in O2.

Hope this can help!

And I agree Bricks templating is very limited compared to O2’s because you can’t freely nest templates in every way you like, which is very frustrating.

So if you want to use the same hero section as page header for the whole website, you have to save it as a section template, then manually insert it in ALL your single/archive/etc. templates, because those templates are kind of top level and independant and can’t be inserted inside a global page template including your hero section.
Well, this is what I’ve understood and maybe I’m missing something as well :wink:

(Hope it’s clear, not that easy to describe in a few words.)

Note that you could put it in your header template, but if you need sticky header it will be a pain, and it will be inside header tag, which you might not want, depending on your layout.
(I personnally prefer to have my page header tag inside main tag, which seems to be more HTML5 compliant.)

Blockquote

Note that you could put it in your header template, but if you need sticky header it will be a pain, and it will be inside header tag, which you might not want, depending on your layout.

Blockquote

Thanks for the reply but I don’t understand why I am able to insert the template into the page in the Bricks editor, preview it from the Bricks editor, yet the page will be show the inserted Section.

If I insert the Template Section named HERO into my CONTENT Template, it shows inside the Bricks Editor AND on the page (but it does not appear inside the Gutenberg Editor if that matters).

Have you added the template element (with Bricks content selected) in your content template?
Because if not, your page content won’t be rendered, like if you didn’t have Inner content in O2.

By the way I think template conditions don’t apply to section templates, they make no sense or I didn’t get it.
But maybe @timmse could confirm that.

You also mention Gutenberg editor which has nothing to do with that so this is not an issue if you don’t see anything there :wink:

The conditions work for the content but not elsewhere if I insert it with the condition of “Entire Site”, with the exception of the CONTENT template I created.

I think if conditions are to work as expected, inserting them should work no matter where you insert a template if it meets the condition.

Again, in the case of the HERO template I created, if I insert it in any place other than the CONTENT template I made, the inserted template would display in the editor, in preview, but not the page when rendered. Other templates such as ones assigned to Header or Footer do work in the editor and the page.

Personally, I feel this is a bug and I think I will report it as such at this point.

Hey John,
Omega and Yan have already answered straightforwardly and competently, but I’ll try to explain it as simply as possible.

In advance: It’s unnecessary to post the same request here in How To, via direct message, and again in the Bug Category. If no one had responded to this post, I would indeed have replied in due time :wink:

All Bricks templates (except the Section, Header, and Footer templates) follow the WordPress Template Hierarchy.

Header and Footer templates are automatically applied to the entire website. Therefore, if you want to use a different header on a specific page within your website, you have to create another header and give it the appropriate condition to override the “Default Header”.

Then there are various other template types such as Single (for single posts or pages), Archive (for posts, taxonomies, tags, etc.), Search Results, Error Pages (404), WooCommerce (for various WooCommerce areas), all of which follow the WordPress Template Hierarchy.

Example: You create a general archive template (WP Hierarchy > archive.php) that applies to all archives. Now you want this template to look different for a certain category. So you duplicate the template, change its appearance, and the condition to Archive > Categories & Tags > Lorem Ipsum (WP Hierarchy > category-lorem-ipsum.php). From now on, this template applies to your “lorem ipsum” category archive.

Section templates, on the other hand, are more general templates, or “building blocks” that you can use to create either complete page layouts (for reuse purposes) or just specific, individual sections. You can then use these individual sections within your other templates. An example of a simple section template would be a CTA section containing a form for your newsletter. You can insert this section template into your other templates in three ways:

  1. directly: if you insert the template directly, it is as if you built it straight within the page. Therefore, changes to the section template will not apply if you insert it directly.
  2. template element: this makes your section template “globally” usable. If you change your section template, the changes apply everywhere where you have included the template with the template element.
  3. shortcode: alternatively to the template element, you can insert the template shortcode, but this is less comfortable.

Briefly about Conditions and Section Templates: There are no sections in the WordPress Template Hierarchy. Accordingly, you can’t assign your Section Templates via Condition (in theory, you can, but with unexpected results).

From my point of view, the whole confusion arises only from the fact that we stick to the WordPress Template Hierarchy, which is very complex at first sight. However, once you understand the principle, the use of the conditions and everything else becomes evident (I hope).

By the way: If you really want your Hero Section to be the same everywhere, you can put it together with your Navbar in your Header Template. This way it will be displayed on every page for sure.

In summary, the behavior is definitely not a bug. I can understand that you have difficulties, especially at the beginning (and after using another builder for a very long time) - but please don’t let that deter you. Sooner or later it will hopefully “click”.

Best regards,
timmse

4 Likes

This did not behave as expected. When I assigned the template to Single, it would appear in the editor but not the page.

Blockquote

template element: this makes your section template “globally” usable. If you change your section template, the changes apply everywhere where you have included the template with the template element.

Blockquote

If this is the way to use these Section templates, how to I make them a “Section Element”?

But what if I want the NAV to be sticky but not the HERO?

Would it be possible for your team to create or can you point me to a concise video on how the different methods work?

Thanks

Hey John,
Here we go: battle of the blockquotes :smiley:

What exactly do you expect? Have you given your single template a condition so that it applies to single posts, for example? Do you use the Post Content element within your Single Template that can output either Gutenberg Content or Bricks Content? Element: Post Content – Bricks Academy

I’m not sure I understand the question, but: you create a template of type Section (fun fact: the section template does not have to contain “section”. It can also contain just a button, pricing table or other things).

Then you edit the page of your choice or another template where you want your previously created section template to be displayed. You can insert the template in three ways, which I described above.

Okay, that’s the exception and that’s exactly when it doesn’t work, of course. However, you can also create a section template for your Hero and include it within your other templates (Single, Archive, etc.) and freely designed pages via template element. This can be a lot of work for enormously large pages, but unfortunately, there is no other way at the moment - but we are working on a solution for the header problem.

What methods do you mean exactly? How to create and use templates?
Please have another look at the Academy, where we have explained the most important things in writing as well as in video. If you have any questions about specific points, please let me know.

Best regards,
timmse

@jmcbade

If you use the template element then whatever you edit in the original template will reflect in all the places where you are using this template as an element.

If you insert the template from the top toolbar then it won’t work as a global template and it will be unique wherever you insert it.

Thank you @timmse from the silent among us who follow these discussions. Very helpful explanation.

1 Like

After trying to “Unlearn” O2 :stuck_out_tongue: for a few days I think I am starting to get it. I have been using O2 a LONG time.

Yeah and the fact that in some cases Bricks has somewhat O2 Template behaviors but in others strictly WP Template Hierarchy behaviors has been hard to grasp, especially at first.

I saw the issue when trying to combine a sticky NAV in the Header with a Hero and that’s what really started this whole thing for me, because I was thinking like O2.

I found these two links from Sridhar’s “Bricks Labs” helpful:

Thanks for everyone’s time to reply.

2 Likes