Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro
Docs

Blocks

Registering a block from your theme

The plugin registers the blocks of ugly-blocks/ by itself. You can also do it with WordPress' own function, from functions.php:

1 minute to read Updated 1 week ago

PHP
add_action( 'init', function () {
	register_block_type( get_theme_file_path( 'ugly-blocks/hero' ) );
} );

The block gets its fields and its drawing the same way, and it is not registered twice.

Did this article answer your question?