Skip to content

Instantly share code, notes, and snippets.

@thetwopct
Created September 8, 2021 15:41
Show Gist options
  • Save thetwopct/d5e17c9bafbbfcdb5913359712cd7a77 to your computer and use it in GitHub Desktop.
Save thetwopct/d5e17c9bafbbfcdb5913359712cd7a77 to your computer and use it in GitHub Desktop.
Register an ACF Block (Gutenberg) with API v2 options
// register the dots background block.
acf_register_block_type(
array(
'name' => 'section-dots',
'title' => 'Section - Dots',
'description' => 'A full width section similar to group block to allow for dots background image.',
'render_template' => get_template_directory() . '/theme-parts/blocks/section-dots.php',
'enqueue_style' => get_template_directory() . '/theme-parts/blocks/section-dots.css',
'mode' => 'preview',
'icon' => 'format-aside',
'keywords' => ['section', 'group', 'dots'],
'supports' => [
'align' => false,
'align_content' => true,
'align_text' => true,
'color' => [
'text' => true,
'background' => true,
'link' => true,
],
'border' => [
'radius' => true,
'width' => true,
'style' => true,
'color' => true,
],
'spacing' => [
'padding' => true,
],
'full_height' => true,
'anchor' => true,
'customClassName' => true,
'jsx' => true,
],
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment