You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
"$schema": "https://raw.githubusercontent.com/WordPress/gutenberg/trunk/schemas/json/theme.json",
"version": 3,
"title": "Post content in red headings",
"slug": "red-headings",
"blockTypes": [ "core/post-content" ],
"description": "Post content with red headings.",
"styles": {
"elements": {
"heading": {
"color": {
"text": "#ff0000"
}
}
}
}
}
When this style variation is applied to the core/post-content block within the page.html template, it renders correctly on the frontend. However, in the Site Editor, the styles are not applied unless the "Show template" option is enabled.
Expected Behavior:
The styles defined in the block style variation JSON should be applied in the Site Editor regardless of the "Show template" setting.
Actual Behavior:
The styles are only applied in the Site Editor when "Show template" is enabled.
Step-by-step reproduction instructions
Create the above JSON file in the specified directory.
Add <!-- wp:post-content {"className":"is-style-red-headings"} /--> to the page.html template.
Open a page and add some headings to the content
Observe that the custom styles are not applied in the editor.
Enable the "Show template" option.
Observe that the custom styles are now applied.
Screenshots, screen recording, code snippet
WordPress.Playground.mp4
Environment info
No response
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
Please confirm which theme type you used for testing.
Description
I've registered a custom block style variation for the
core/post-contentblock using a JSON file located at:[theme]/styles/blocks/post-content-red-headings.json{ "$schema": "https://raw.githubusercontent.com/WordPress/gutenberg/trunk/schemas/json/theme.json", "version": 3, "title": "Post content in red headings", "slug": "red-headings", "blockTypes": [ "core/post-content" ], "description": "Post content with red headings.", "styles": { "elements": { "heading": { "color": { "text": "#ff0000" } } } } }When this style variation is applied to the
core/post-contentblock within thepage.htmltemplate, it renders correctly on the frontend. However, in the Site Editor, the styles are not applied unless the "Show template" option is enabled.Expected Behavior:
The styles defined in the block style variation JSON should be applied in the Site Editor regardless of the "Show template" setting.
Actual Behavior:
The styles are only applied in the Site Editor when "Show template" is enabled.
Step-by-step reproduction instructions
<!-- wp:post-content {"className":"is-style-red-headings"} /-->to thepage.htmltemplate.Screenshots, screen recording, code snippet
WordPress.Playground.mp4
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.