Hi all,
I’ve read every thread on the forum that’s remotely related to this issue and I’m stumped. I have a couple of Field Groups utilizing Flexible Content fields which have been working fine. However, a new Field Group I’m working with is returning Null for all flex content sub fields.
So far, I’ve tried deleting and recreating both the sub-fields and the flex content field itself with no luck. I’ve double checked I’m using ‘get_sub_field’ in my template. I’ve switched on debug mode and gotten no php errors. I’ve created a new Field Group with one Text field and a Flex content field with a Text sub-field and associated it with a different post type for testing.
Same problem.
Here’s my code:
<?php get_header(); ?>
<div class="container mb-1 text-xs-center">
<div class="row">
<?php
echo get_field('fix_text_field_1');
echo get_sub_field('fix_text_field_2');
?>
</div>
</div>
<?php get_footer(); ?>
And here’s some screenshots for context:
When using a flex field you need to have a loop https://www.advancedcustomfields.com/resources/flexible-content/
if (have_rows('flex_field_name')) {
while (have_rows('flex_field_name')) {
the_row();
echo get_sub_field('fix_text_field_2');
}
}
*facepalm*
No more coding to the point of exhaustion for me.
Thanks very much John.