Support

Account

Home Forums Add-ons Flexible Content Field Creating a line break after every fourth layout. Reply To: Creating a line break after every fourth layout.

  • Hi @phillustration

    You can introduce a simple counter variable like so:

    
    <?php  
    /*
    *  PROFILE BLOCK
    */
    $i = 0;
    
    while(has_sub_field("secondary_departments")): $i++; ?>
        
        <?php if(get_row_layout() == "secondary_department"): // layout: Content ?> 
        	<h3><?php the_sub_field('department_header'); ?></h3>
            <?php the_sub_field('department_description'); ?>
    
            <img src="<?php the_sub_field('department_thumbnail'); ?>" />
    	<?php endif; ?>
    	
    	<?php if( $i == 4 ): $i = 0; ?>
    		<div class="clear"></div>
    	<?php endif; ?>
     
    <?php endwhile; ?>
    

    Thanks
    E