Skip to main content
1 of 2

How do I apply different block supports to different parts of my custom block?

I am developing a custom block for my WordPress plugin. The block is meant to be very similar to the WordPress core search block. On the default search block, there are several supports declared, including for border, background color, text color, text size, etc. This block is able to apply styles and classes from the block supports to different elements in the block. For example, the background color control only changes the background color of the button, and the font size support only applies to the label above the search input. I am looking for a solution for how to accomplish this in my block. My block is a server rendered block using the render.php file, and I am having a hard time finding a convenient and scalable way to use the string returned by get_block_wrapper_attributes() to apply styles only to certain parts of my block. Is there a good way to do this that I am missing? Or do I need to simply pick elements out of this string based on my own predetermined rules?