How to create block templates for specific Page Templates?
-
How can we set up a block template for specific Page Templates?
Previously, I have used ACF to extensively customize the available fields and give clients the option to build varying layouts using custom blocks (using the Flexible Content field). These custom blocks have tightly controlled HTML/CSS output so that the look and feel of each page is consistent with the branding and other pages of the site (so the user isn’t able to create off-brand layouts by changing the size of text and layout elements or using off-brand colours, fonts, etc)
I’ve decided to try and embrace Gutenberg through the use of ACF Blocks. What I have found is I have had to disable many of the default blocks because they provide too much creative control to the user which would result in the aforementioned creation of off-brand layouts/elements, breaking the continuity of the overall site design.
One thing I’m struggling with is that in the past, I used page templates for certain pages that require custom layouts/template logic and a specific set of custom fields. With ACF, field groups could be assigned to a Page Template and the field group would switch out as soon as you changed the page template. With Gutenberg we don’t seem to able to achieve this as the available blocks don’t swap out when you change the page template.
I know there is the option to set up “block templates” – but they can only be applied to all posts in a CPT or all pages. I was really excited to learn about this only to be disappointed as I’m not actually able to use this great feature on my current project. What we need is the ability to customize the block template depending on the type of page (ie. the page template). The biggest roadblock I see to this right now is that the user must select the page template and update the page before the new block template would appear. This is far from ideal as most users will probably just jump right into editing the page with the available default blocks.
Is this something that the Gutenberg team is working on?
- The topic ‘How to create block templates for specific Page Templates?’ is closed to new replies.