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 So, what is the best way to do this that I am missing? Or do I needextract specific styles from the block wrapper attributes to simply pickapply to specific elements out of this string based onin my own predetermined rulescustom block's render.php
?