FSE: Toggle editor post title visibility with a filter / Set block template editor setting #34296
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this Pull Request
Toggle editor post title visibility with a filter
This PRs implements a more robust approach than #34214 as suggested by @gwwar in order to avoid potential rendering flashes (#34214 (comment)).
Now, the
a8c/post-content
block always renders a post title before the content, but is hidden by default. It will show up when theadmin_body_class
filter adds theshow-post-title-before-content
class, which will also hide the regular editor post title. This makes unnecessary the selectorisFullSitePage
added in #34214, so it has been removed on this PR.Set block template editor setting
The above caused a side effect. Since the FSE plugin creates a default template that is assigned to all pages without a specific template, we would get the
show-post-title-before-content
class when creating a new page. This was making the post title to be missing because at the moment we are not applying the template parts when we start a new post.This has been fixed on this PR by defining a block template on the
template
editor settingFollow-up
This PR will introduce a couple of known issues:
a8c/post-content
block can be removed by the user, resulting in a missing post title since theshow-post-title-before-content
would keep the regular editor post title hidden.Should we fix them before landing this PR?
Testing instructions