I am trying to make a 2 column responsive layout using ACF repeater field. I have tried using a counter, but I don’t think I am formatting it right. Basically it needs to look like this:
<div class="row-fluid">
<div class="span6">
<h2>TITLE</h2>
<img src=""/>
<p>DESCRIPTION</p>
</div>
</div>
<div class="row-fluid">
<div class="span6">
<h2>TITLE</h2>
<img src=""/>
<p>DESCRIPTION</p>
</div>
</div>
etc...
This is the PHP I have:
<?php if(get_field('events')): ?>
<div class="row-fluid">
<?php while(has_sub_field('events')): ?>
<div class="span6">
<h2><?php the_sub_field('title'); ?></h2>
<?php if(get_sub_field('photo')) { ?>
<?php $image = wp_get_attachment_image_src(get_sub_field('photo'), 'full'); ?>
<img src="<?php echo $image[0]; ?>" alt="<?php echo get_the_title(get_field('photo')) ?>" />
<?php } else { ?><img src="" /><?php } ?>
<p><?php the_sub_field('description'); ?></p>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
Read more here: Make ACF repeater responsive