1

I'm trying to use Gutenberg's InnerBlocks with ACF Blocks in my allowedBlocks I have [ 'core/heading', 'core/paragraph', 'core/buttons'] In my 'core/buttons' block I'd like to allow multiple buttons, but it only seems to enable one.

My block template is as follows:

[
    [
         'core/heading',
         [
             'level'       => 3,
             'placeholder' => __( "Add Heading...", THEMENAME ),
             'align'       => 'center',
             'className'   => 'has-text-align-center',
         ],
     ],
    [
          'core/paragraph',
          [
               'placeholder' => __( "Add paragraph text...", THEMENAME ),
               'align'       => 'center',
          ],
    ],
    [
          'core/buttons',
          [
               'align'       => 'center',
          ],
    ],
] 

Additionally the align 'center' doesn't seem to work for this block.

1
  • It seems the immediate issue is resolved by removing templateLock="all" on <InnerBlocks />. However, I'd still like to lock the template but allow multiple buttons. Still can't get them centered by default!
    – benedict_w
    May 4, 2022 at 10:09

1 Answer 1

1

if you have a look at this site: https://developer.wordpress.org/block-editor/reference-guides/core-blocks/#buttons

You can see that "Core/Buttons" (plural) only supports "full/wide" on "align". You can however use "align" => "center" on "core/button". I don't know how you can add multiple buttons inside "core/buttons", but you can however add multiple "core/button" inside your template:

[ 'core/button', [ 'align' => 'center' ] ],
[ 'core/button', [ 'align' => 'center' ] ],

Hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.