gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Improve the Site Editor preview for PHP templates

Open carolinan opened this issue 1 year ago • 2 comments

What problem does this address?

If you activate a hybrid theme, or a classic theme that is a child theme of a block theme, the PHP page template files can not be edited in the Site Editor. This is a current fact, that may be apparent for developers/designers and advanced users, but not to all.

  • If you are on the front of the site, and you are viewing content that uses a PHP template, and you click on the "Edit Site" link in the top toolbar,
  • If you are in the admin area, and you open Appearance > Editor,

Then the Site Editor preview opens but it is empty except for the loading animation. It looks like it is trying to load the template, but nothing happens. I am testing this on macOS.

What is your proposed solution?

It may be better to display a message saying that this template can not be previewed.

Instructions

Create a new classic child theme and set the parent to twentytwentyfour. Add a index.php and a home.php template in the theme folder of the child theme. Activate the child theme. Open the Site Editor and view the preview.

The Site Editor with a blank preview

carolinan avatar Jul 04 '24 11:07 carolinan

How about using the <Warning>? (With or without the loader)

A PHP template from a child theme is viewed in the Site Editor

carolinan avatar Jul 29 '24 09:07 carolinan

Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

github-actions[bot] avatar Aug 29 '24 00:08 github-actions[bot]

Closing as a duplicate, in favor of https://github.com/WordPress/gutenberg/issues/64341

carolinan avatar Nov 27 '24 08:11 carolinan