Home Forums General Issues Nested Flexible Content Fields


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 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 }	?>
    						<?php if(get_sub_field('sidebar_copy')) { ?>
    						<div class="row sidebar-copy">
    							<div class="col-sm-12">
    								<?php the_sub_field('sidebar_copy'); ?>
    						<?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';
    						endwhile; ?>
    	    <?php endwhile; ?>
    	<?php endif; ?>	
  • Elliot, never-mind!

    That code works perfectly fine. Editing the custom fields I lost the post data and had to re-enter it.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Nested Flexible Content Fields’ is closed to new replies.