WPDev.one
CSS
PHP
Server-Side Best Practice

Register Custom Block Style

Add a "Fancy Border" style to the core Image block. This uses the modern server-side registration method, which only loads the CSS when the style is actually used on a page.

Live Preview

Portrait
A portrait of a model (Core Image Block)

Integration Steps

Register in PHP

Add the PHP snippet to your functions.php file. This registers the style name is-style-fancy-border with WordPress.

Apply in Editor

Go to the Block Editor, select an Image block, and look at the "Styles" panel in the sidebar. You will see a new "Fancy Border" option.

Default
Fancy