-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Expose the Patterns menu to the Classic theme #5201
Expose the Patterns menu to the Classic theme #5201
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly testing as advertised for me @t-hamano.
I ran into an issue though when testing Twenty Twenty One with block-template-parts
support added. I get the "The theme you are currently using is not compatible with the Site Editor." error.
src/wp-admin/site-editor.php
Outdated
if ( ! current_theme_supports( 'block-template-parts' ) && $is_template_part_editor ) { | ||
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); | ||
} elseif ( ! $is_patterns_editor ) { | ||
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I think this is blocking classic themes with block-template-parts
support to access the template part editor. I think we can adjust it to:
if ( ! current_theme_supports( 'block-template-parts' ) && $is_template_part_editor ) { | |
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); | |
} elseif ( ! $is_patterns_editor ) { | |
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); | |
} | |
if ( ! current_theme_supports( 'block-template-parts' ) || ! $is_template_part_editor && ! $is_patterns_editor ) { | |
wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) ); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix is almost identical to what I tried locally. With this applied, I can now access all the links as advertised in the PR description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( ! current_theme_supports( 'block-template-parts' ) || ! $is_template_part_editor && ! $is_patterns_editor ) {
In the case of this conditional statement, I think classic themes that do not support block-templates-parts will not be able to access the Patterns page. I think I was able to control all cases correctly with the update using 879cb3b.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tests well for me now however I think there is some test code we need to remove before it's ready to land.
Co-authored-by: Aaron Robertshaw <[email protected]>
Please let me know if there are any other considerations or potential issues in order to ship this patch and |
That would be a wise move I think. I'm caught up on other patterns issues/PRs at the moment but will try and organise another review for this one. Thanks for the nudge 👍 |
I believe this patch is fine and good to go. The Gutenberg PR though still has an unaddressed issue that I'd flagged previously. The command palette change in that PR needs reverting so that the user is taken to the same location as the links introduced in this patch for classic themes. |
Update: The Gutenberg PR that corresponds to this core patch is actually #54422. Sorry for causing confusion. Once this core patch is applied, the classic theme can access the Site Editor's Patterns page by typing |
Just noting here that this enhancement has been slated for WP 6.5 as it missed the 6.4 beta |
👋 Hello team. Whats the update on this feature for WP 6.5? Is it likely to land and if so which features (as originally outlined in the roadmap) will make it. Thanks in advance 🙏 |
By merging this PR, the following will be achieved in the classic theme as of WP6.5.
More details can be found in this comment. |
@t-hamano's comment covers nicely what will be delivered via this PR. I believe this should be good to go but we might want a quick sanity check review and approval with fresh eyes before doing so. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this and it works as expected. I think this is a great feature and I don't see any blockers for it to go into WordPress 6.5.
It's approved from my end 👍
I reached out for clarification on this feature in WP Slack as I've heard different things about what the actual experience will be for users of WP 6.5. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just did some testing and it seems to work fine.
This just exposes a page in the menu that was already accessible anyway.
Just tested the PR. It does not work as expected. My classic theme uses |
@kebbet the theme support you are removing is only removing the core pattern library. It does not prevent users from being able to create pattern using the UI, nor does it remove any patterns added via plugins or themes. I'm not aware of any method to remove the patterns functionality as a whole. So I don't think what you are describing is a blocker for merging this at it is unrelated. I would recommend you create a new issue for adding the ability to disable patterns altogether if that is what you are hoping to accomplish. |
@youknowriad Based on x2 approving reviews can we commit this one? |
Trac ticket: https://core.trac.wordpress.org/ticket/58827
Testing Instructions
Block Theme
Block theme with customizer
Classic Theme
Classic Theme with block-template-parts support
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.