repeater2
// Add Shortcode
function acf2repeaters_function( $atts ) {
// Attributes
$atts = shortcode_atts(
array(
'repeater1' => '',
'repeater1_nb' => '',
'repeater2' => '',
),
$atts
);
<?php while ( have_posts() ) : the_post(); ?>
<?php // check for rows (parent repeater) ?>
<?php if( have_rows('R1') ): ?>
<div id="R1">
<?php // loop through rows (parent repeater) ?>
<?php while( have_rows('R1') ): the_row(); ?>
<div>
<h3><?php the_sub_field('title'); ?></h3>
<?php // check for rows (sub repeater) ?>
<?php if( have_rows('R2') ): ?>
<ul>
<?php // loop through rows (sub repeater) ?>
<?php while( have_rows('R2') ): the_row(); ?>
<?php // display each item as a list - with a class of completed ( if completed ) ?>
<?php //<li <?php if( get_sub_field('completed') ){ ?>
<li <?php echo ' class="T32"';?>><?php the_sub_field('T32');?></li>
<?php endwhile; ?>
</ul>
<?php endif; //if( get_sub_field('R2') ): ?>
</div>
<?php endwhile; // while( has_sub_field('R1') ): ?>
</div>
<?php endif; // if( get_field('R1') ): ?>
<?php endwhile; // end of the loop. ?>
}
add_shortcode( 'acf2repeaters', 'acf2repeaters_function' );