-
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
When removing core pattern, allow theme.json pattern slugs to be listed in inserter #41282
Comments
Yes, I have confirmed the current functionality, and agree with this proposal. While I still think many themes will register their own patterns and use |
I agree, I think it would make it easier for theme authors to select exactly which patterns they want to feature from the directory. |
@bph and @carolinan are you testing with Gutenberg active? I have been trying to diagnose this today and think I found a solution, but it depends on #40824 being resolved. There were changes made in core that have not yet been backported to Gutenberg. I will write up a PR, but if you have a chance to test, can you try the following?
Let me know if you run into any issues. Thanks! 🙏 |
@ndiego I just followed your instructions and the patterns from the directory showed up nicely. |
I'm thinking this may be the norm one day. Instead of including them in a single theme, having the patterns available within the theme — but also for everyone else. |
This was closed incorrectly, reopening. |
Tried the PR, and looks good. 👍 |
This fix will be included in WordPress 6.0.2, and I just added #43634 to fix the 6.0 compat file in Gutenberg. |
What problem does this address?
At the moment, `remove_theme_support( 'core-block-patterns' ); is an all or nothing with allowing pattern directory patterns to be viewed in the inserter.
Being able to still use the theme.json registration of pattern via slugs from the pattern directory, allows a curated list of patterns and more granular control.
What is your proposed solution?
The theme developer would set in functions.php
remove_theme_support( 'core-block-patterns' );
and set in theme.json the list of pattern allowed:
"patterns": [ "short-text-surrounded-by-round-images", "partner-logos" ]
There could be a check that if there is a theme.json pattern setting, it would allow them to be visible in the Inserter.
Instead an "Disallow all" it should be an explicit allow.
With the growing number of pattern in the directory, a curation would help with the exposure of patterns in the editor. The more patterns there are the more theme developer would want to restrict the visiblity. This feature would give them the means instead of just blocking all patterns from the directory, select the few that should work well.
The text was updated successfully, but these errors were encountered: