Support

Account

Home Forums Add-ons Flexible Content Field Gutenberg Blocks in Flexible Content Fields Reply To: Gutenberg Blocks in Flexible Content Fields

  • So I found the Clone field from which I can reference the fields from another Field Group. It seems to be working! Now I can have Elementor take over my WP Editor and still have Flexible Fields below it so that my clients can fill in simple content without messing with carefully laid out layouts made with Elementor. One remaining issue is the render_template for the block. I now need to ask if we are in a row_layout or not.

    <?php
    
    //Normal Gutenberg Block
    $quote = get_field("quote");
    
    //See if it's really a Flexible Content Row
    if(get_row_layout() == 'gutenberg_testimonial_block'){
        $quote = get_sub_field('quote');
    }
    ?>
    <div class="acf-block-testimonial">
        <blockquote><?= $quote ?></blockquote>
    </div>

    It would be a little messy on more complicated templates.

    Does my above solution make sense or does anyone else have input on a better way?