Support

Account

Home Forums Gutenberg InnerBlocks use multiple & allowed_blocks Reply To: InnerBlocks use multiple & allowed_blocks

  • I have spend multiple hours trying to figure a way around this and to my likings I haven’t found an ideal solution. The problem is Innerblocks isn’t really an ACF function but a WordPress function.

    Although I don’t really understand your question the closest I’ve come to a workable pagebuilder with container+columns is this way:

    This is a content container block

    $allowed_blocks = [ 'acf/contentpartial' ];
    <div id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($className); ?>">
        <?php if($container == 'container-fluid'): echo '<div class="container">';  endif; ?>
            <div class="row">
                    <InnerBlocks 
                    allowedBlocks="<?php echo esc_attr( wp_json_encode( $allowed_blocks ) ); ?>"
                    />
    
            </div>
        <?php if($container == 'container-fluid'): echo '</div>'; endif; ?>
    </div>

    In which you load the partial:

    $allowed_blocks = [ 'core/heading', 'core/paragraph','core/list', 'core/button', 'core/image', 'core/shortcode', 'gravityforms/form'];
    $col = get_field('col_grootte');
    ?>
    <div id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($className); ?> <?php echo $col; ?> pt-<?php the_field('ruimte_boven'); ?> pb-<?php the_field('ruimte_onder'); ?> editor-reset">
        
        <div class="content-block">
    
            <InnerBlocks allowedBlocks="<?php echo esc_attr( wp_json_encode( $allowed_blocks ) ); ?>" />
    
        </div> 
    
    </div>

    This only problem is that you have to manually select the column size. It can’t be col-6 whenever there are 2 partials automatically.