This stems from #33157 and older threads such as #22208 (comment)
Example: tt1-blocks theme
I've looked at what the TT1-blocks theme needs for styling in CSS. A large part of its styles is block style variations. This is what the theme has to do to set up the block style variations it wants.
Register its own block style variations:
- In block-styles.php: register its own block style variations.
- In blocks.css: define the CSS for those block style variations.
- In functions.php enqueues the CSS for the block styles variatons for the editor (via hooking into
after_setup_theme) and for the front-end (via hooking into wp_enqueue_scripts).
Unregister existing block styles variations it doesn't want active:
- In unregister-block-style.js: unregister the block style variations it doesn't want to be shown.
- In functions.php: enqueue the above script via
enqueue_block_editor_assets so it takes effect.
This stems from #33157 and older threads such as #22208 (comment)
Example: tt1-blocks theme
I've looked at what the TT1-blocks theme needs for styling in CSS. A large part of its styles is block style variations. This is what the theme has to do to set up the block style variations it wants.
Register its own block style variations:
after_setup_theme) and for the front-end (via hooking intowp_enqueue_scripts).Unregister existing block styles variations it doesn't want active:
enqueue_block_editor_assetsso it takes effect.