I got a client that uses a lot of reusable blocks and local patterns. He creates a lot of reusable blocks from some source ones I’ve created for him. In certain scenarios, I’ve created custom post types with ACF custom fields and all he does is he fills in the ACF info and then the custom blocks appear in sidebars as post loops.
My goal is to be able to future-proof reusable blocks and local pattern layouts. I could use global styles but still it doesn’t give me enough flexibility. Take the recent flex and container updates for example. Any local patterns created with a previous version would still hold legacy functionality. What if there was a way to control the block layout so that any previous block was instantly updated?
if i read this correctly, you would ideally like a local pattern to have similar behaviour to a reusable block, in that all instances of its use are synced ?
I think so. If I was to change the pattern layout I would like the changes to mirror on the instances. I would like to cover the case where the local pattern contains a query loop from a custom post type with ACF fields attached to it.
Is it possible?
Why not just use the Reusable block ?
Here is an example: I have created a couple of credit card compare reusable blocks for a client and I have also assigned a few global styles. Some of them he uses as is some others he takes them and renders them as normal blocks and changes content. In some cases I create local patterns for him, too. Now, let’s say, I want to change the layout for some blocks, e.g. convert to flex, change number of columns, etc. It would be nice if those blocks were locked into some kind of template so that they could all change accordingly regardless of their content.
It would be nice but it would require something rather magical to achieve that 🙂
The Reusable Block ( or GP Element ) is as close to that as you can get.
But what you can’t do is force a change across all instances of a “pattern” when each of them has its own unique static content. There would be no way of stopping that content from being overwritten.
If all of the content however was dynamic and stored in the single post meta then you could separate content from HTML and styles and then something close to what you want could be achievable.
Yeah, I see. I am more interested in the last option where all dynamic data are stored in the post meta. How could this work in achieving something close?
Tricky to say the least.
We would need to add support for Repeater / Flexible fields in ACF.
And update the Query Loop block to support other content / data types.
Then it may be possible to loop over the meta and conditionally display that content, which you would still build within a reusable block or GP element.
Its super complicated.
Ok, I see, I will leave it at that, lol.
It would be super cool if there was an easy way to do this 🙂
We’ll keep our thinking caps on.
Glad to be of help
- You must be logged in to reply to this topic.