1<?php
2
3// ACF REPEATER - BASIC LOOP
4
5// check if the repeater field has rows of data
6if( have_rows('repeater_field_name') ):
7
8 // loop through the rows of data
9 while ( have_rows('repeater_field_name') ) : the_row();
10
11 // display a sub field value
12 the_sub_field('sub_field_name');
13
14 endwhile;
15
16else :
17
18 // no rows found
19
20endif;
21
22?>
1<?php if( have_rows('repeater_field_name') ):
2 while( have_rows('repeater_field_name') ): the_row();
3 $image = get_sub_field('image');
4 endwhile;
5endif; ?>
1<?php if( have_rows('repeater_field_name') ): ?>
2
3 <ul class="slides">
4
5 <?php while( have_rows('repeater_field_name') ): the_row();
6
7 // vars
8 $image = get_sub_field('image');
9 $content = get_sub_field('content');
10 $link = get_sub_field('link');
11
12 ?>
13
14 <li class="slide">
15
16 <?php if( $link ): ?>
17 <a href="<?php echo $link; ?>">
18 <?php endif; ?>
19
20 <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
21
22 <?php if( $link ): ?>
23 </a>
24 <?php endif; ?>
25
26 <?php echo $content; ?>
27
28 </li>
29
30 <?php endwhile; ?>
31
32 </ul>
33
34<?php endif; ?>
1<?php if( have_rows('slides') ): ?>
2 <ul class="slides">
3 <?php while( have_rows('slides') ): the_row();
4 $image = get_sub_field('image');
5 ?>
6 <li>
7 <?php echo wp_get_attachment_image( $image, 'full' ); ?>
8 <p><?php the_sub_field('caption'); ?></p>
9 </li>
10 <?php endwhile; ?>
11 </ul>
12<?php endif; ?>
1if( have_rows('rating_field') ):
2 while ( have_rows('rating_field') ) : the_row();
3 $title = the_sub_field('rating_title');
4 $number = the_sub_field('rating_number');
5
6 echo $title;
7 echo $number;
8 endwhile;
9else :
10endif;