Home › Forums › ACF PRO › How do I display Flexible Content inside a Repeater Field › Reply To: How do I display Flexible Content inside a Repeater Field
I figured out a work around
$feature is the parent repeater field.
<?php $media = $feature['feature_media']; if($media): ?>
<div id="feature_media">
<?php
foreach($media as $key=>$row) {
$layout = $row['acf_fc_layout'];
if($layout == 'static_image'):
$image = $row['image'];
echo '<img src="'.$image['url'].'">';
elseif($layout == 'slideshow'):
$slides = $row['images'];
if($slides):
echo '<ul class="slides">';
foreach($slides as $slide) {
echo '<img src="'.$slide['url'].'">';
}
echo '</ul>';
endif;
elseif($layout == 'video'):
$embedcode = $row['embed_code'];
echo $embedcode;
endif;
} // end each row
?>
</div>
<?php endif; // end if media ?>
Not sure this is the right approach but at least it worked.
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.