Skip to content

Explore block style variations as packages of style attributes #33232

@oandregal

Description

@oandregal

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:

  1. In block-styles.php: register its own block style variations.
  2. In blocks.css: define the CSS for those block style variations.
  3. 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:

  1. In unregister-block-style.js: unregister the block style variations it doesn't want to be shown.
  2. In functions.php: enqueue the above script via enqueue_block_editor_assets so it takes effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block VariationsBlock variations, including introducing new variations and variations as a feature[Feature] Theme Style VariationsRelated to style variations provided by block themes[Type] DiscussionFor issues that are high-level and not yet ready to implement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions