Unlock Hidden Power: 6 Little-Known Ways to Master Custom Block Styles in WordPress

Unlock Hidden Power: 6 Little-Known Ways to Master Custom Block Styles in WordPress
.is-style-black-border img {
   border: 15px ridge black;
}

Due to a bug, you need to add the style.css to the frontend. It doesn’t seem to be automatically loaded. You use wp_enqueue_style() and then use the hook wp_enqueue_scripts.

Then you’d add the following to your functions.php or plugin file:

function enqueue_theme_styles() {
   wp_enqueue_style(
       'my-theme-styles',
       get_stylesheet_uri(), // This gets your style.css
       array(),
       wp_get_theme()->get( 'Version' )
   );
}
add_action( 'wp_enqueue_scripts', 'enqueue_theme_styles' );

You also need to add style.css to the block editor so your users can see how the block style looks when they are working on the post or page. 

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

You May Have Missed