Skip to content

Instantly share code, notes, and snippets.

@tjhole
Created December 1, 2015 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjhole/4aacff4393f0697d6f87 to your computer and use it in GitHub Desktop.
Save tjhole/4aacff4393f0697d6f87 to your computer and use it in GitHub Desktop.
<?php
// check if the flexible content field has rows of data
if( have_rows('flexible_content_field_name') ):
// loop through the rows of data
while ( have_rows('flexible_content_field_name') ) : the_row();
// check current row layout
if( get_row_layout() == 'gallery' ):
// check if the nested repeater field has rows of data
if( have_rows('images') ):
echo '<ul>';
// loop through the rows of data
while ( have_rows('images') ) : the_row();
$image = get_sub_field('image');
echo '<li><img src="' . $image['url'] . '" alt="' . $image['alt'] . '" /></li>';
endwhile;
echo '</ul>';
endif;
endif;
endwhile;
else :
// no layouts found
endif;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment