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.