Last active
September 14, 2017 12:39
-
-
Save jasonglisson/8daec5544282e024b3d8 to your computer and use it in GitHub Desktop.
ACF Repeater Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if( have_rows('background_images') ): ?> | |
<?php if( get_field('random_images') ): ?> | |
<ul class="slides custom_bg img_bg random"> | |
<?php else: ?> | |
<ul class="slides custom_bg img_bg"> | |
<?php endif; ?> | |
<?php $i = 0; | |
while( have_rows('background_images') ): the_row(); | |
$i++; | |
// vars | |
$image = get_sub_field('image'); | |
$caption = get_sub_field('caption'); | |
$title = get_sub_field('image_title'); | |
?> | |
<li class="slide" style="background-image: url(<?php echo $image; ?>);"> | |
<?php if($title): ?> | |
<div class="caption"> | |
<div class="photo-title"><?php echo $title; ?></div> | |
<?php if($caption): ?> | |
<div class="photo-caption"><?php echo $caption; ?></div> | |
<?php endif; ?> | |
</div> | |
<?php endif; ?> | |
</li> | |
<?php endwhile; ?> | |
</ul> | |
<?php if($i > 1): ?> | |
<div class="click-btn"> | |
<div class="home-prev-photo btn">‹</div> | |
<div class="home-next-photo btn">›</div> | |
</div> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment