Home › Forums › Add-ons › Repeater Field › Repeater Help
I am using a repeater from ACF to allow easily editable content. I then display the information put into the repeater like so :
IMG | Content
Content | IMG
IMG | Content
I now no longer need an image in the second row, so i need second row of content in the repeater to show the content to be a large-12 cell. I have this code but i’m unsure of how to adapt it so it outputs like
IMG | Content
Content |
IMG | Content
Any help is massively appreciated.
<div class="grid-x grid-margin-x grid-padding-x">
<?php $i=0 ; if(get_field( 'biography_repeater')):
while(has_sub_field( 'biography_repeater')): $i++;
$image=get_sub_field( 'biog_img');?>
<div class="grid-x grid-margin-x grid-padding-x">
<!-- right column -->
<div class="large-6 cell biog-card">
<?php if (($i % 2)==0 ): ?>
<h2>
<?php the_sub_field( 'biog_title'); ?>
</h2>
<hr />
<p>
<?php the_sub_field( 'biog_desc'); ?>
</p>
<?php else: ?>
<img src="<?php echo $image['url']; ?>" />
<?php endif; ?>
</div>
<div class="large-6 cell biog-card">
<?php if (($i % 2)==0 ): ?>
<img src="<?php echo $image['url']; ?>" />
<?php else: ?>
<h2 style="text-align:right;">
<?php the_sub_field( 'biog_title'); ?>
</h2>
<hr />
<p style="text-align:right;">
<?php the_sub_field( 'biog_desc'); ?>
</p>
<?php endif; ?>
</div>
<!-- right column -->
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 ACF & ACF PRO 6.0.7 are now available.
— Advanced Custom Fields (@wp_acf) January 18, 2023
✨This release contains bug fixes and improvements while we continue to work on the next major release of ACF.https://t.co/wQgAOpwmUI
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.