I am trying & learning to build custom block/template for Gutenberg and would like to “pre-set” CSS class for some specific block. Is it possible to add it like below?
Refer: [Template and Block][1]
For example, defined CSS class for one of the heading blockHeadStyle
:
function myplugin_register_book_post_type() {
$args = array(
'public' => true,
'label' => 'Books',
'show_in_rest' => true,
'template' => array(
array( 'core/image', array(
'align' => 'left',
) ),
array( 'core/heading', array(
'placeholder' => 'Add Author...',
'class' => 'blockHeadStyle'
) ),
array( 'core/paragraph', array(
'placeholder' => 'Add Description...',
)),
),
);
register_post_type('book', $args);
}
add_action('init', 'myplugin_register_book_post_type');