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

Hybrid themes don't work if the fallback is block-based #31633

Open
carlomanf opened this issue May 9, 2021 · 8 comments
Open

Hybrid themes don't work if the fallback is block-based #31633

carlomanf opened this issue May 9, 2021 · 8 comments
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended

Comments

@carlomanf
Copy link

Description

I understand that the support for hybrid themes was mostly tested on cases where the fallback template was index.php rather than block-templates/index.html.

When block-templates/index.html is present, and there is a mix of PHP and block templates, the support for hybrid themes is unclear.

Step-by-step reproduction instructions

  1. Add single-post.php to TT1 Blocks
  2. Open a post on the front-end, and observe that the PHP template is loaded
  3. Open the Site Editor
  4. Open the side menu by clicking on the site icon
  5. Open Posts, and observe that all posts are listed
  6. Click on one of the posts, and observe that nothing loads

Expected behaviour

I can think of three possible solutions:

  1. Just hide from the menu any parts of the site that are not block-based. This would make the Site Editor potentially functional for all themes, but it breaks the promise that the Site Editor lets you edit the whole site.
  2. Enable the Site Editor to render PHP templates in a read-only manner, still allowing the post content to be edited. This would also make the Site Editor potentially functional for all themes, but it would be the most complicated solution to implement.
  3. Ignore PHP templates altogether (a.k.a. do not support hybrid themes) whenever block-templates/index.html is present. This could be done by gating the template loader's support for hybrid themes behind ! gutenberg_is_fse_theme().
@aristath
Copy link
Member

The template fallbacks currently only work for the frontend, the site-editor is still a WIP and has not been taken into account. Since the site-editor will not be included in WP5.8 this was not a pressing priority.
But I agree, it should be fixed 👍

@carlomanf
Copy link
Author

The template fallbacks currently only work for the frontend, the site-editor is still a WIP and has not been taken into account. Since the site-editor will not be included in WP5.8 this was not a pressing priority.
But I agree, it should be fixed 👍

What would be the correct behaviour? I'm curious.

@abaicus
Copy link
Contributor

abaicus commented Dec 16, 2022

Hey!

I created a proof of concept theme to showcase how some classic themes might want to allow users to take advantage of the full-site-editing features. I've mentioned it in #46495, which has been marked as a duplicate of this issue. You can find the repository here: https://github.com/abaicus/fse-hybrid-poc.

The main issue I've encountered seems to be the same as what's mentioned here. In my case, enabling the FSE templates only for single posts & pages will break the site editor, as it tries redirecting to the front page when loading (which will use the old PHP template).

I think that points 1 & 2 suggested by @carlomanf could be viable solutions.

@carolinan
Copy link
Contributor

carolinan commented Jan 2, 2023

I am trying to understand this better: you want to enable all the site editor features: not only the template editing, in a classic theme, but only for some pages.
How would the global styles sidebar work, the access to creating new templates and template parts?

@carolinan
Copy link
Contributor

If you only wanted to enable template editing, the theme support should be enough.
Or is the real issue that you can only edit templates that have posts and pages assigned, not 404 and archives?

@carlomanf
Copy link
Author

carlomanf commented Jan 2, 2023

Or is the real issue that you can only edit templates that have posts and pages assigned, not 404 and archives?

I think this is indeed the real issue. If a hybrid theme forcibly enables the site editor in order to edit 404 and archives with blocks, any present PHP templates will cause the site editor to crash. See also #44224.

@carolinan
Copy link
Contributor

carolinan commented Jan 2, 2023

I still strongly believe that enabling the site editor in classic themes would be a step backwards, and not make it easier for users and developers to switch, only make it easier for them to fall behind.

@carlomanf
Copy link
Author

I still strongly believe that enabling the site editor in classic themes would be a step backwards, and not make it easier for users and developers to switch, only make it easier for them to fall behind.

I think such a discussion is more relevant to #44224. I don't have a strong personal preference about whether the site editor is enabled for hybrid themes, but if not, solution number 3 as described above would be required in order to disable the site editor for hybrid themes.

@annezazu annezazu added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") and removed [Feature] Full Site Editing labels Jul 24, 2023
@jordesign jordesign added the [Type] Bug An existing feature does not function as intended label Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

7 participants