Check that register_block_style exists

This function is not in core WordPress yet, so we should check for it in case Gutenberg is deactivated.
This commit is contained in:
Kelly Dwan 2019-10-01 13:45:31 -04:00
parent 30b7c0786e
commit ec4afa649d
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D

View file

@ -60,23 +60,25 @@ function setup() {
) )
); );
register_block_style( if ( function_exists( 'register_block_style' ) ) {
'core/group', register_block_style(
array( 'core/group',
'name' => 'wporg-parallelogram', array(
'label' => __( 'Parallelogram', 'wporg-5ftf' ), 'name' => 'wporg-parallelogram',
'style_handle' => 'wporg-style', 'label' => __( 'Parallelogram', 'wporg-5ftf' ),
) 'style_handle' => 'wporg-style',
); )
);
register_block_style( register_block_style(
'core/paragraph', 'core/paragraph',
array( array(
'name' => 'wporg-tldr', 'name' => 'wporg-tldr',
'label' => __( 'Summary paragraph', 'wporg-5ftf' ), 'label' => __( 'Summary paragraph', 'wporg-5ftf' ),
'style_handle' => 'wporg-style', 'style_handle' => 'wporg-style',
) )
); );
}
// todo also setup block styles for other things, like the quote symbol, etc. // todo also setup block styles for other things, like the quote symbol, etc.
} }