-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Site Editor: Add context for templates that can not be previewed #64050
Conversation
Size Change: +81 B (0%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
Or perhaps "The template you are currently using is not compatible with the Site Editor." |
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 If 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. |
Flaky tests detected in 60b92a1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11587645443
|
The condition that checks if the message should show or not is not correct, because if there is a home template saved in the database, the message still flash on screen briefly, before the saved (user edited/ user created) template shows. |
What?
Add context to the Site Editor preview when a template can not be loaded.
With the "Site Editor Preview" I mean the canvas where the blocks in a template normally show when you go to
Appearance > Editor.
An example of a template that can not be previewed is a PHP template added in a hybrid theme (A block theme that also has PHP template files) or a PHP template added in a classic child theme where the parent is a block theme.
Please see the issue for details. #63124
Why?
Currently it looks like the Site Editor is trying to load the PHP template in the preview, as it shows the loader animation, but stops progressing.
How?
Adds a conditional check for:
Then uses the
<Warning>
component to display the context "The template can not be previewed."Testing Instructions
Test wether viewing a PHP template in the site editor show the message, or only loads a blank preview with the loader animation. Here is one example of how to test this:
In Twenty Twenty Four, using your preferred file editor, rename home.html to home.php and then move home.php to the root folder of the theme. Congratulations, you have created a hybrid theme.
With reading settings set to "Your homepage displays: latest posts", WordPress will now try to load home.php.
Open the Site Editor by going to Appearance > Editor.
Testing Instructions for Keyboard
Screenshots or screencast
With the PR: