Support

Account

Home Forums Add-ons Repeater Field Get first row from repeater field within loop

Solving

Get first row from repeater field within loop

  • Good afternoon!
    I have a problem. I can’t solve it in any way. How to Get first row from repeater field within loop ‘master’ (sub_field)
    Please help me solve the problem!

    <?php if ( have_rows( 'masters' ) ) : ?>
    	<?php while ( have_rows( 'masters' ) ) : the_row(); ?>
    		<?php the_sub_field( 'category-name' ); ?>
    		<?php if ( have_rows( 'master' ) ) : ?>
    			<?php while ( have_rows( 'master' ) ) : the_row(); ?>
    				<?php $master_img = get_sub_field( 'master-img' ); ?>
    				<?php $size = 'full'; ?>
    				<?php if ( $expert_img ) : ?>
    					<?php echo wp_get_attachment_image( $expert_img, $size ); ?>
    				<?php endif; ?>
    				<?php the_sub_field( 'master-name' ); ?>
    				<?php the_sub_field( 'master-subject' ); ?>
    				<?php the_sub_field( 'master-mark' ); ?>
    				<?php the_sub_field( 'master-experience' ); ?>
    			<?php endwhile; ?>
    		<?php else : ?>
    			<?php  ?>
    		<?php endif; ?>
    	<?php endwhile; ?>
    <?php else : ?>
    	<?php  ?>
    <?php endif; ?>
  • Please indicate in your code where you are trying to get this value.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.