Create Custom Block Style Using PHP

Place this in functions in order to create your own custom block styles and render them in the editor.

add_action('init', function() {
	register_block_style('core/image', [ // affect block
		'name' => 'drop-shadow', // custom slug, added to css
		'label' => __('Drop Shadow', 'shadow'), // label and description
	]);
});

Source.

Leave a Reply

Posted in php
katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.