Add method for plugins to register theme style variations #63574
Labels
[Feature] Extensibility
The ability to extend blocks or the editing experience
[Feature] Theme Style Variations
Related to style variations provided by block themes
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
Currently, only themes can "register" theme style variations by adding JSON files to their
/styles
folder.WP_Theme_JSON_Resolver::get_style_variations()
does this by scanning the folder and looking for the files in the parent and child themes: https://developer.wordpress.org/reference/classes/wp_theme_json_resolver/get_style_variations/However, there are no filter hooks or an API for adding custom variations outside of using the
/styles
folder.Related support forum issue: https://wordpress.org/support/topic/custom-wordpress-styles-variations-for-block-themes-using-plugin/
What is your proposed solution?
There are several methods that might be worth exploring:
theme.json
-like style data via PHP (similar to what's possible with block style variations andregister_block_style()
).WP_Theme_JSON_Resolver::get_style_variations()
to let plugins filter the variations.Each of these methods could also potentially solve #51277
The text was updated successfully, but these errors were encountered: