Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Building Gutenberg Blocks with ACF — Register Block
/**
* Register hero block
*/
add_action('acf/init', 'hero');
function hero() {
// check function exists
if( function_exists('acf_register_block') ) {
// register a hero block
acf_register_block(array(
'name' => 'hero',
'title' => __('Hero'),
'description' => __('Image background with text & call to action.'),
'render_callback' => 'hero_render_callback',
'category' => 'formatting',
'icon' => 'format-image',
'mode' => 'preview',
'keywords' => array( 'hero', 'image' ),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.