Support

Account

Home Forums Gutenberg InnerBlocks – no + button to add a block

Solving

InnerBlocks – no + button to add a block

  • Am I missing something or misunderstanding something? I can’t see to get a ‘+’ Add Block button to show in the backend when I select the block which has InnerBlocks in it. I’m not seeing the $template content either

    Here is the Register

    acf_register_block_type(array(
    ‘name’ => ‘case-study-block-container’,
    ‘title’ => __(‘Case Study block container’),
    ‘description’ => __(‘Case Study block container’),
    ‘render_callback’ => ‘theme_acf_render_callback’,
    ‘category’ => ‘custom-blocks’,
    ‘icon’ => $block_icon,
    ‘keywords’ => array( ‘BGEN’, ‘case’, ‘study’, ‘block’, ‘container’ ),
    ‘mode’ => ‘edit’,
    ‘supports’ => array(
    ‘mode’ => false,
    ‘anchor’ => true,
    ‘jsx’ => true
    ),
    ‘example’ => array(
    ‘attributes’ => array(
    ‘mode’ => ‘preview’
    )
    )
    ));

    Here is the code for the block

    <?php

    $block_abbr = ‘csbc’;
    $block_id = $block_abbr . ‘-‘ . $block[‘id’];
    if( !empty($block[‘anchor’]) ) {
    $block_id = $block[‘anchor’];
    }
    $block_classes = ‘block block-‘ . $block_abbr . ‘ ‘ . $block_abbr . ‘-‘ . $block[‘id’];
    if( !empty($block[‘className’]) ) {
    $block_classes .= ‘ ‘ . $block[‘className’];
    }

    if ( $is_preview ) {
    echo ‘‘;
    return;
    }

    $allowed_blocks = array( ‘core/heading’, ‘core/paragraph’ );

    $template = array(
    array(‘core/heading’, array(
    ‘level’ => 2,
    ‘content’ => ‘Title Goes Here’,
    )),
    array( ‘core/paragraph’, array(
    ‘content’ => ‘Colorway: Style Code: Release Date: MSRP: ‘,
    ) )
    );

    ?>
    </div>
    </div>
    </div>
    </div>

    <div id=”<?php echo $block_id; ?>” class=”<?php echo $block_classes; ?>”>
    <?php echo ‘<InnerBlocks allowedBlocks=”‘ . esc_attr( wp_json_encode( $allowed_blocks ) ) . ‘” template=”‘ . esc_attr( wp_json_encode( $template ) ) . ‘” />’; ?>
    </div>

  • Same issue here…

    Somehow the button magically disappeared. 😀

  • I started to have my first attempt with ACF + InnerBlocks and ran into exactly the same problem. Ist there any solution for this?

  • Same problem here! And same first try with InnerBlocks ^^
    I thought I was doing something wrong…
    When I insert the block with the editor, I do not see anything… No button to add blocks.
    But when I define a template, I see the blocks :/ But still no “add block” button…

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.