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

Accessing template editor from a post or page no longer edits in context of that post or page #60695

Closed
maxmorgan opened this issue Apr 12, 2024 · 6 comments
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.

Comments

@maxmorgan
Copy link

Description

We've noticed since upgrading from 6.4.3 to 6.5.2 that there's a behavioral change when entering a template editor directly from a page or post. Previously, this would open the editor with the page or post used as a source of truth for content. Now, it always opens with placeholder content as if we were entering from the site editor.

The previous behavior was advantageous as it gave a 'truer' representation of how our templates look and feel with our real content and gave us a better opportunity to test layout changes with real custom field data.

WordPress documentation also shows off the previous behavior when discussing template editing for posts, so so this seems like a regression.
https://wordpress.org/documentation/article/template-editor/#to-edit-a-template
(See the video captioned "Editing an existing page template"

Step-by-step reproduction instructions

Steps to reproduce:

  • Enter a post (e.g. "Hello World")
  • Click the template on the right hand side in the post panel
  • Click 'Edit template'

Expected behavior:

  • Single posts template opens with the current post ("Hello World") being used to help me build my template

Actual behavior:

  • Single posts template opens with sample content being used to help me build my template

I've also attached a video of a fresh/brand new installation using 2024 theme and just one single plugin (Pods) to demonstrate why the previous (expected behavior) was useful.

Screenshots, screen recording, code snippet

Demonstration Video:

https://youtu.be/jVd09xEyFI8

Before:

wp-before-1

wp-before-2

After:

wp-after-1

wp-after-2

Environment info

  • WordPress / 6.5.2
  • Twenty Twenty-Four / 1.1

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

@maxmorgan maxmorgan added the [Type] Bug An existing feature does not function as intended label Apr 12, 2024
@fabiankaegy
Copy link
Member

Hey @maxmorgan 👋

Thanks for your report here. I'm sorry to say that this is not in fact a regression in the sense that this was a change made on purpose.

There was a lot of feedback in previous versions of this flow that it is too confusing/difficult to know when you are editing something that is a part of the template vs something that is part of the current post. So it led to many unintentional template edits that broke sites.

Because of that, the experience was split into these two distinct editing modes. The post-only, template-locked and the template-only modes.

However, I do agree that it is very beneficial to have actual content visible whilst editing a template instead of just seeing the post content blocks placeholder text.

@ellatrix @youknowriad @noisysocks @talldan @richtabor I wonder whether it makes sense for us to add an additional mode that works similarly to template-locked but inverted. Where the template is visible, but all the post-content-related blocks would be locked / disabled. (the inverse of DisableNonPageContentBlocks)

@fabiankaegy fabiankaegy added [Type] Enhancement A suggestion for improvement. [Feature] Template Editing Mode Related to the template editor available in the Block Editor and removed [Type] Bug An existing feature does not function as intended labels Apr 12, 2024
@noisysocks noisysocks added the Needs Design Feedback Needs general design feedback. label Apr 15, 2024
@noisysocks
Copy link
Member

My instinct is that that would be confusing to the majority of users, but I defer to @SaxonF and @jameskoster. I recall at one point we discussed having the ability to select which post was being previewed in the View dropdown.

@jameskoster
Copy link
Contributor

I agree that by not showing any content the separation between template and content is more obvious. This is particularly helpful for folks who are less familiar with how templates work (which is most people).

But eventually it would be nice to support both. IE when editing a template you can view it abstracted (template-only), contextually based on referrer (edit page -> edit template), or with a specific, compatible record loaded in.

I recall at one point we discussed having the ability to select which post was being previewed in the View dropdown.

There's an issue for that one here: #28466, but it hasn't been updated in a long time.

@fabiankaegy
Copy link
Member

I'm not sure I agree with the sentiment that it necessarily is more confusing to showcase the content in a locked mode.

The reason why I think that is because it often is quite important to see how differently aligned elements, regular content width, wide & full align, right & left align etc. render in a template. And currently, there is no way to really see that unless you jump back and forth.

Because of that I think it would either be good to improve the placeholder state of the post content to have some more representative data in it. Or to move forward with a mode that enables this preview :)

@jameskoster
Copy link
Contributor

Because of that I think it would either be good to improve the placeholder state of the post content to have some more representative data in it. Or to move forward with a mode that enables this preview :)

They might be part of the same solution. Preview options being;

  • None (basically what we have now)
  • Sample content (a more elaborate version of what we have now)
  • A specific item of compatible local content

They're all useful in different scenarios...

@youknowriad
Copy link
Contributor

I think with the "show preview" toggle that is now being more visible in the "preview" dropdown, we can consider this issue resolved. "Editing the template with a given post visible" is still not possible but providing that context is tracked here #28466

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 Needs Design Feedback Needs general design feedback. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants