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

Wrong template displayed for hybrid themes in the post template editor #64341

Open
2 tasks done
jffng opened this issue Aug 7, 2024 · 5 comments
Open
2 tasks done

Wrong template displayed for hybrid themes in the post template editor #64341

jffng opened this issue Aug 7, 2024 · 5 comments
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended

Comments

@jffng
Copy link
Contributor

jffng commented Aug 7, 2024

Description

The post template editor shows the wrong template for hybrid themes that contain a mix of block and php templates.

Step-by-step reproduction instructions

  1. Activate a classic theme that has a single.php or page.php (e.g. twentytwentyone)
  2. Add a templates/index.html file.
  3. Go to add / edit a post or page.
  4. Verify the template editor renders the index.html, instead of single.php.
  5. Verify the front-end renders the single.php.

Screenshots, screen recording, code snippet

Kapture.2024-08-07.at.11.11.50.mp4

Environment info

  • WP 6.6.1 with Twenty Twenty-One

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes
@jffng jffng added [Type] Bug An existing feature does not function as intended [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Feature] Template Editing Mode Related to the template editor available in the Block Editor labels Aug 7, 2024
@carlomanf
Copy link

I think these may be related and/or duplicate issues: #31633 #63124 #64303

@youknowriad
Copy link
Contributor

I think we should disable template previews and template editing for hybrid themes unless we're certain that the associated template is a block template one.

@carolinan
Copy link
Contributor

I tried looking into this today but was not able to get any closer to solving it.

@youknowriad
Copy link
Contributor

@Mamaduka This issue is going to become more important to solve, now that "show template" is more prominent.

@Mamaduka
Copy link
Member

I think an extra check (hasTemplate) added by @jorgefilipecosta in #68110, partially solves that issue.

@Mamaduka Mamaduka added the [Priority] High Used to indicate top priority items that need quick attention label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Priority] High Used to indicate top priority items that need quick attention [Type] Bug An existing feature does not function as intended
Projects
Development

No branches or pull requests

5 participants