[wp-trac] [WordPress Trac] #61605: Add Support for dynamically changing WordPress styles variations using filter

WordPress Trac noreply at wordpress.org
Wed Jul 10 01:31:01 UTC 2024


#61605: Add Support for dynamically changing WordPress styles variations using
filter
-------------------------+------------------------------
 Reporter:  noamanahmed  |       Owner:  (none)
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Themes       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------------------

Comment (by aaronrobertshaw):

 Great discussion and ideas here!

 I like the suggestion of a single registration function for style
 variations. There could be a future where theme and block style variations
 are more interchangeable. Long term, a single registration function should
 prove easier to maintain, evolve, and discover.

 To accommodate registering theme style variations, we'd need a registry to
 store them like the block styles are in `WP_Block_Styles_Registry`.
 Unfortunately, `WP_Block_Styles_Registry` was marked as final when it was
 created which makes it difficult to experiment in Gutenberg first.

 With either `register_block_style` or `WP_Block_Styles_Registry`, if their
 scope is expanded beyond block style variations, they probably need a
 rename too.

 One approach that might make exploring this feature easier, could be,
 creating a more generic registry (e.g. `WP_Style_Variation_Registry`) and
 a new global function (e.g. `register_style_variation`). The existing
 function and registry class could then be updated to essentially be
 wrappers and perhaps even deprecated eventually.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61605#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list