I have to add a specific class to my first, third and fifth element in a foreach loop in php ot thuis code below =>
<?php foreach($leaders as $l) : ?>
<?php if(get_field('type', $l->ID) == 'NY Staff') : ?>
<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
<div class="member-info">
<div class="photo">
<img class="img-responsive" src="<?php the_field('image', $l->ID); ?>" alt="">
</div>
<div class="info">
<div class="name"><?php echo get_the_title($l->ID); ?></div>
<div class="body">
<div><span class="job-name"><?php the_field('position', $l->ID); ?>,</span> based in <?php the_field('location', $l->ID); ?></div>
<a href="<?php echo get_permalink($l->ID); ?>" class="read-more">
<svg id="_24x24" data-name="24x24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.cls-1{fill:#FFFFFF;}</style></defs><path id="icon-arrow-right" class="cls-1" d="M12.46 12L6 19l2.77 3L18 12 8.77 2 6 5l6.46 7z"/></svg>
</a>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php endforeach; ?>
So i have to add this class in the img element below the div=>photo to the code below=>
<div class="photo">
<img class="img-responsive" src="<?php the_field('image', $l->ID); ?>" alt="">
</div>
Thank you in advance! cheers