Template priorities

I have a simple scenario that has proved a little more tricky than I had hoped, related to how templates are applied.

  • I have a site-wide template applied to all posts (let’s call it “AllPosts”).

  • For a subset of posts, I want to apply a tag to apply a different template. So I have a template, called say “SpecialPosts”, that will target those posts, based on a Terms condition.

It was my hope and assumption that I could target the “SpecialPosts” template via a Terms condition and, because that is more specific, it would take predence over “AllPosts” template.

That does not seem to be the case, though. For the “AllPosts” template I need to add another condition, specifically to exclude the tag.

I was hoping to avoid a situation where I have to maintain stuff like this in two locations (the targeted template AND as an exclusion to the AllPosts template).

Have I understood that correctly? If so, is there any other mechanism I can use here that effectively dictates the priority of templates?

3 Likes

Oh … I did not test this yet, but I fully support your initial expectations of how it should work (but doesn’t).

Hope this will be addressed anytime soon!

1 Like

Thank you, @beziehungsweise.

There are probably many ways to address this technically, if we eventually get more flexibility. The one that springs to mind for me is a combination of

  • Good documentation for how this currently works (perhaps that already exists in a Bricks-specific document, beyond the standard WordPress template hierarchy)
  • An optional template priority field.

I would imagine many sites wouldn’t need to use a priority for templates, but it woukld be a pretty easy and intuitive mechanism for those who do.

That said, my hope here is just to confirm that I have understood this all correctly and there are currently no other options than to maintain the exclusions.

Thanks again.

3 Likes

Good ideas! Template priorities would for sure be a great addition!

1 Like

any new about that? how did you get it work? I get in the same scenario frquently.