Support

Account

Home Forums ACF PRO How do I display Flexible Content inside a Repeater Field

Solved

How do I display Flexible Content inside a Repeater Field

  • I have setup a repeater field and am trying to display the flexible field inside. No matter what I have tried, I am unable to get the values out of the flexible field. Is there a trick?

  • 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.

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

You must be logged in to reply to this topic.