Support

Account

Home Forums Add-ons Repeater Field Insert something into the repeater loop? Reply To: Insert something into the repeater loop?

  • Hi @kyon147

    Sure there is. Let’s assume that you’re using have_rows for looping out your repeater. Here’s an example of how you could do it:

    
    <?php
    if( have_rows('repeater') ){
    	$i = 1;
    	while( have_rows('repeater') ){
    		the_row();
    		
    		//stuff
    		the_sub_field('subfield');
    		
    		//advert after every third row
    		if( $i % 3 == 0 ){
    			//advert code
    		}
    		
    		$i++;
    	}
    	
    }
    ?>