Created
March 12, 2019 11:48
-
-
Save tessak22/ac8d10e44b2ba3da64c3abc970e72e0f to your computer and use it in GitHub Desktop.
Building Gutenberg Blocks with ACF — Register Block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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