Hi, I just bought ACF Pro and can’t manage to get data from my Flexible Content fields.
I have a site coded by a real company (I just started dabble) so took their code (that works on our live site) but it isn’t working.
I can get data from regular Fields
This is my config
Field Group: Main Blocks
Field Name: Main Blocks (main_blocks) (set to Flexible Content)
First Layout Name: Preamble (preamble)
First Layout Sub Field: Preamble Text (preamble_text)
<?php
$main_blocks = get_field( 'main_blocks');
if( $main_blocks ):
?>
<?php
while ( have_rows( 'main_blocks' ) ) : the_row();
get_template_part( 'blocks/'.get_row_layout() );
endwhile;
?>
<?php endif; ?>
The Block Template for preamble.php
<?php
$preamble_text = get_sub_field( 'preamble_text' );
if( $preamble_text ):?>
<div class="container grid grid-guttersXl">
<div class="grid-cell">
<?php echo $preamble_text; ?>
</div>
</div>
<?php endif; ?>
For error management I tried the first If, but no matter how I write it, it doesn’t return any values.
Tried with the exact same code as in the forum examples, but still no output.
Yes, cleared cache and checked that the json output happens.