Home › Forums › Front-end Issues › Cloned Group in repeater in flexible content
Hello,
Having issue getting my cloned group to show up within a repeater field that is inside a flexible content layout. Any help would be appreciated, cannot figure out what is wrong with my code!
// check if the flexible content field has rows of data
if( have_rows('page_layout') ):
// loop through the rows of data
while ( have_rows('page_layout') ) : the_row();
// check current row layout
if( get_row_layout() == 'hero_banner' ):
// check if the nested repeater field has rows of data
if( have_rows('hero_item') ): ?>
<div id="hp-hero" class="carousel slide carousel-fade" data-ride="carousel">
<!--Indicators-->
<ol class="carousel-indicators">
<?php
$licount = 0;
while ( have_rows('hero_item') ) : the_row();
if($licount == 0):
?>
<li data-target="#hp-hero" data-slide-to="<?php echo $licount ?>" class="active"></li>
<?php else: ?>
<li data-target="#hp-hero" data-slide-to="<?php echo $licount ?>"></li>
<?php endif;
$licount++; ?>
<?php endwhile; ?>
</ol>
<!--/.Indicators-->
<!--Slides-->
<div class="carousel-inner" role="listbox">
<?php
// loop through the rows of data
$count = 0;
while ( have_rows('hero_item') ) : the_row();
$h1 = get_sub_field('large_text');
$h2 = get_sub_field('small_text');
$mask = get_sub_field('mask');
$maskClass= 'hm-black-light';
if($mask == "Slight"):
$maskClass = 'hm-black-slight';
elseif($mask == "Medium"):
$maskClass = 'hm-black-light';
elseif($mask == "Dark"):
$maskClass = 'hm-black-strong';
endif;
if($count == 0):
?>
<div class="carousel-item active">
<?php else: ?>
<div class="carousel-item">
<?php endif; ?>
<div class="view <?php echo $maskClass; ?>">
<?php
if( have_rows('background_area') ):
while( have_rows('background_area') ): the_row(); ?>
<?php
$background = get_sub_field('background_area_background');
$image = get_sub_field('background_area_image');
$color = get_sub_field('background_area_color'); ?>
<?php if($background == "Image"): ?>
<img class="d-block w-100" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php else: ?>
<div class="color-fw-div" style=" background-color: <?php echo $color ?>;"></div>
<?php
endif;
endwhile; ?>
<?php endif; ?>
<!--<img class="d-block w-100" src="http://multisite.morevisibility.com/wp-content/uploads/2018/05/hp-banner1.jpg" alt="<?php /*echo $image['alt']; */?>" />-->
<div class="mask"></div>
</div>
<div class="carousel-caption">
<h3 class="h3-responsive"><?php echo $h1; ?></h3>
<p><?php echo $h2; ?></p>
</div>
</div>
<?php $count++; endwhile; ?>
</div>
<!--/.Slides-->
<!--Controls-->
<a class="carousel-control-prev" href="#hp-hero" role="button" data-slide="prev">
<span class="carousel-control-prev-icon"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#hp-hero" role="button" data-slide="next">
<span class="carousel-control-next-icon"></span>
<span class="sr-only">Next</span>
</a>
<!--/.Controls-->
</div>
<?php
endif;
endif;
endwhile;
else :
// no layouts found
endif;
?>
Same issue here. I’m beginning to suspect that this doesn’t work. Heading over to read the docs to see if there are any known bugs. Did you ever get it working? Or did you give up, like I’m about to do?
The topic ‘Cloned Group in repeater in flexible content’ 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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.