Skip to content
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

Patterns: Use patterns from the directory in the pattern block. #47880

Open
scruffian opened this issue Feb 8, 2023 · 4 comments
Open

Patterns: Use patterns from the directory in the pattern block. #47880

scruffian opened this issue Feb 8, 2023 · 4 comments
Labels
[Block] Pattern Affects the Patterns Block [Feature] Pattern Directory The Pattern Directory, a place to find patterns [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Enhancement A suggestion for improvement.

Comments

@scruffian
Copy link
Contributor

What problem does this address?

The pattern block loads patterns based on a slug:
<!-- wp:pattern {"slug":"core/simple-header"} /-->

This works when the pattern is in the theme, but if the pattern comes from the directory it only works in the editor, not in the front end. To reproduce, add this to the header.html of your active theme:

<!-- wp:pattern {"slug":"core/simple-header"} /-->

Load the site editor - you'll see the pattern.
Load the front end - the pattern is missing.

@scruffian scruffian added [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Feature] Pattern Directory The Pattern Directory, a place to find patterns [Block] Pattern Affects the Patterns Block labels Feb 8, 2023
@scruffian scruffian mentioned this issue Feb 8, 2023
14 tasks
@richtabor
Copy link
Member

Are you thinking it'd always pull from the directory, unless the parent template was edited?

@scruffian
Copy link
Contributor Author

Yes exactly, the same way that the block works for theme patterns. I think this could be powerful for themes as it means they can assemble a whole from the pattern directory very easily, and if the patterns need updating they will get the updates without doing anything.

Simple themes could just be a collection of patterns and styles with no need for custom templates.

@richtabor
Copy link
Member

I think this could be powerful for themes as it means they can assemble a whole from the pattern directory very easily, and if the patterns need updating they will get the updates without doing anything.

I lean towards an inserted/template-applied pattern being locked to the theme/site—not editable from the Pattern Directory. It may introduce more issues than its worth (patterns updates that disrupt the site). I'm also not sure if this functionality would be used much. Maybe for headers, but most other patterns would be manipulated before publishing imo.

@scruffian
Copy link
Contributor Author

My main thought was for headers, footers and query patterns. It would be powerful to be able to create a whole site just by reusing patterns from the directory. The approach would also have some maintenance benefits - any updates done to the patterns in the directory would immediately benefit the theme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Pattern Affects the Patterns Block [Feature] Pattern Directory The Pattern Directory, a place to find patterns [Feature] Patterns A collection of blocks that can be synced (previously reusable blocks) or unsynced [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants