Skip to content

Instantly share code, notes, and snippets.

@pavlo-bondarchuk
Created December 17, 2018 08:29
Show Gist options
  • Save pavlo-bondarchuk/9efbd6efa15301ad9495c75635e24e27 to your computer and use it in GitHub Desktop.
Save pavlo-bondarchuk/9efbd6efa15301ad9495c75635e24e27 to your computer and use it in GitHub Desktop.
ACF repeater in group
<?php
// Stop if there's nothing to display.
if ( ! have_rows( 'services', 'option' ) ) {
return false;
}
if ( have_rows( 'services', 'option' ) ) : ?>
<?php while ( have_rows( 'services', 'option' ) ) : the_row();
// Services Sub Repeater.
if ( have_rows( 'services_list' ) ) : ?>
<ul class="services">
<?php
while ( have_rows( 'services_list' ) ) : the_row();
$image = get_sub_field( 'icon' );
$title = get_sub_field( 'service_title' );
?>
<li class="services-single">
<img src="<?php echo esc_url( $image['sizes']['thumbnail'] ); ?>" alt="<?php echo esc_html( $image['alt'] ); ?>"?>
<?php echo esc_html( $title ); ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment