Support

Account

Home Forums Front-end Issues wrapping repeater field inside divs depending of select sub field Reply To: wrapping repeater field inside divs depending of select sub field

  • Hi @intramorosgmail-com

    I believe you can do it like this:

    <div class="row row_tabs">
    
        <?php if(get_field('reference', 64)): $i = 0;?>
    
        <?php while(has_sub_field('reference', 64)):?>
    
        <?php if(get_sub_field('categorie') == "finance"):?>
        
        <?php if ($i % 4 == 0) { ?>
        
        <div class="row row_tabs">
        
        <?php } ?>
    
        <div class="col-xs-3 text-center">
    
            <div class="inside">
    
                <?php $image = get_sub_field('logo'); ?>
    
                <?php if($image):?>
    
                <img data-src="<?php echo $image['sizes']['medium']; ?>" class="lazyload" />
    
                <?php endif; ?>
    
            </div>
    
        </div>
        
        <?php $i++; ?>
    
        <?php if ($i % 4 == 0) { ?>
        
        </div>
        
        <?php } ?>
    
        <?php endif; ?>
    
        <?php endif; ?>
    
        <?php endwhile; endif; ?>
    
    </div>

    Please learn more about PHP here: http://www.w3schools.com/php/.

    I hope this helps.