Home › Forums › Add-ons › Repeater Field › Multiple Image Sizes › Reply To: Multiple Image Sizes
You’d be able to do this if you do an incrementing variable like:
<?php $i = 1; if( get_field('repeater') ): while( has_sub_field('repeater') ): ?>
<?php if ( $i == 1 ) { ?>
This is first list item
<?php } elseif ( $i == 2 ) { ?>
This is second list item
<?php } elseif ( $i == 3 ) { ?>
This is third list item
<?php } elseif ( $i == 4 ) { ?>
This is the fourth list item and so on...
<?php } ?>
<?php $i++; endwhile; endif; ?>
I wouldn’t duplicate the entire block of content that way but maybe like assign the image size to a variable and call it later or just do the $i conditional on the spot with the call to the image or similar. Hopefully that makes sense.
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.