Skip to content

Instantly share code, notes, and snippets.

@bph
Last active May 17, 2019 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bph/c783cdff9fb14877326122e40938d3be to your computer and use it in GitHub Desktop.
Save bph/c783cdff9fb14877326122e40938d3be to your computer and use it in GitHub Desktop.
Example Code for using ACF building blocks
function register_acf_blocks() {
// register a team member block.
acf_register_block(array(
'name' => 'acf-team-member',
'title' => __('ACF Team Member'),
'description' => __('A custom team member block created via ACF 5.8'),
'render_template' => 'content-block-team-member.php',
'category' => 'formatting',
'icon' => 'admin-comments',
'keywords' => array( 'team member', 'team' ),
));
}
// Check if function exists and hook into setup.
if( function_exists('acf_register_block') ) {
add_action('acf/init', 'register_acf_blocks');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment