Base Block Styles Loaded Differently for PHP templates than Block-based HTML templates. #31293
Labels
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
Global Styles
Anything related to the broader Global Styles efforts, including Styles Engine and theme.json
[Type] Bug
An existing feature does not function as intended
Description
When a block-based HTML template is used to render a page base block styles are loaded inline, and are loaded prior to the styles generated based on theme.json.
i.e.
When a php-based template is used to render a page the base block styles are loaded from CSS files instead, and are loaded at the bottom of the body.
The result is incorrect application of styles as the 'base' supersedes the 'generated global styles' in most scenarios.
Step-by-step reproduction instructions
Load (or create) a theme that leverages Global Styles via theme.json but renders PHP templates. (Here is a simple theme as an example.)
Ensure button styles are expressed in the theme.
Expected behavior
Ideally the block base classes would be provided rendered inline in the same fashion for PHP rendered templates as block-based HTML templates.
Ensure a 'button' style is applied (such as background color)
Load a page rendered from a PHP template and observe the styles on a button block in the view.
Actual behavior
WordPress information
This appears to work as expected on
10.4.1
.Also note that disabling block support in the theme also causes it to operate as expected.
remove_theme_support( 'block-templates' );
The text was updated successfully, but these errors were encountered: