Home › Forums › General Issues › Nested Flexible Content Fields
Hey!
I’m setting up two flexible content fields but can’t figure what I’m doing wrong.
I’ll attach my code and custom fields xml below. There are two flexible content fields in the xml file, I’m only referring to the second set.
Everything works except the nested flexible content content field ‘link_flexible_content’.
Thanks in advance!
<div id="getstartedprograms" class="get-started-programs">
<div class="container">
<?php if( have_rows('get_started_programs') ): ?>
<?php while ( have_rows('get_started_programs') ) : the_row(); ?>
<div class="row program">
<div class="col-sm-7">
<div class="title"><?php the_sub_field('title'); ?></div>
<div class="body-copy"><?php the_sub_field('body_copy'); ?></div>
</div>
<div class="col-sm-4 col-sm-offset-1">
<div class="program-pricing">
<div class="row schedule-pricing">
<div class="col-sm-12 schedule">
<?php if(get_sub_field('pricing')) { ?>
$<?php the_sub_field('pricing'); ?>
<?php } ?>
<?php if(get_sub_field('schedule')) { ?>
<small>(<?php the_sub_field('schedule'); ?>)</small>
<?php } ?>
</div>
</div>
<?php if(get_sub_field('sidebar_copy')) { ?>
<div class="row sidebar-copy">
<div class="col-sm-12">
<?php the_sub_field('sidebar_copy'); ?>
</div>
</div>
<?php } ?>
<?php while(has_sub_field("link_flexible_content")):
if(get_row_layout() == "external_link"):
echo 'external';
elseif(get_row_layout() == "internal_link"):
echo 'internal';
elseif(get_row_layout() == "get_started_form"):
echo 'form';
endif;
endwhile; ?>
</div>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
Elliot, never-mind!
That code works perfectly fine. Editing the custom fields I lost the post data and had to re-enter it.
The topic ‘Nested Flexible Content Fields’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.