-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Patterns in Templates #21830
Comments
This would be very useful, any plans to implement this? |
Would also be very interested in this. |
I've closed #36323 as a duplicate of this. That issue was encountered during a triage session in slack (https://wordpress.slack.com/archives/C02QB2JS7/p1636435134063000). There was a suggestion there to use the newly introduced pattern block in the template (see #33217). That block has a @uamv @nachos5 @aandrewjoyce ethanclevenger91 It'd be good to get your feedback on whether this option will work for you. Thanks! |
Fantastic! I'm using it for post type block template. Thanks |
The pattern block works as a CPT As soon as I add Maybe I'm doing something wrong though. Does anyone have a working solution to locking a pattern? Thanks! |
Hey @troytempleman - just checking in on this - did you ever find a way to get it working with Template Lock? |
@jordesign no sorry, I’ve since gone down a block plugin rabbit hole that I’m still in, lol. Will probably be revisiting block themes/templates soon though. |
Given that much has changed in the past couple of years - I'll close this issue as not current. But if you do run into problems again in the future please feel free to open a new issue with updated details. |
@jordesign But although much changed there is still no complete solution when it comes to the template lock. I would like to request this to be reopened in the hope some dev will be able to come up with a solution that handles template lock as expected. |
Absolutely want this feature! It almost works right now, but you have to toggle the code editor on/off in order for the pattern to render. |
I also would like to see this done. Seems potentially related to / could use the same solution as #49005 |
I think this is possible, you can wrap the pattern contents in a group block (so that the group is the top level block inside the pattern) and use the |
Unfortunately, this only locks the pattern and does not prevent modifications to the template (e.g. adding new blocks) which was the initial intent. I've had to fall back to writing the template content in PHP instead of using a pattern. |
If it's a problem, then I think it needs a new issue. This one is meandering away from what the OP requested. |
I've begun tinkering with the experimental block patterns API and expected that I might be able to register patterns and then call upon those registered patterns alongside other registered blocks when defining the template of a CPT.
It'd be great to simply build a template using existing patterns. If this is not already possible in some way, I propose it be considered how to make such templating available.
The text was updated successfully, but these errors were encountered: