Support

Account

Home Forums Add-ons Repeater Field Output first row of a Repeater field as image

Unread

Output first row of a Repeater field as image

  • How can I output just the first row of a Repeater filed, giving that this is my code?

    <?php if ( have_rows( 'gallery' ) ) : ?>
    	<?php while ( have_rows( 'gallery' ) ) : the_row(); ?>
    		<?php the_sub_field( 'image' ); ?>
    	<?php endwhile; ?>
    <?php else : ?>
    	<?php // no rows found ?>
    <?php endif; ?>

    I would like to display just the first image in an <img> tag. So something like <img src="IMAGE URL COMES HERE">

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.