Skip to content

Instantly share code, notes, and snippets.

@dauble
Created October 6, 2017 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dauble/31f06cc6a2244abb0d01551756564b43 to your computer and use it in GitHub Desktop.
Save dauble/31f06cc6a2244abb0d01551756564b43 to your computer and use it in GitHub Desktop.
<ul class="employees__list">
<?php $counter = 0; $class = 'even'; ?>
<?php while(have_rows('employee')): the_row(); ?>
<?php
if($counter % 2 == 0) {
if($class == 'odd') {
$class = 'even';
} else {
$class = 'odd';
}
}
?>
<li class="employees__list__employee<?php echo ' ' . $class; ?>">
<?php $image = wp_get_attachment_image_src(get_sub_field('image'), 'bio-pic'); ?>
<div class="employees__list__employee--image">
<?php if($image): ?>
<img src="<?php echo $image[0]; ?>" alt="" class="img-responsive">
<?php else: ?>
<img src="http://via.placeholder.com/600x600" alt="" class="img-responsive">
<?php endif; ?>
</div>
<div class="employees__list__employee__content">
<div class="employees__list__employee__content--wrap">
<h4 class="employees__list__employee__content--name"><?php echo get_sub_field('name'); ?></h4>
<h5 class="employees__list__employee__content--title"><?php echo get_sub_field('title'); ?></h5>
<p class="employees__list__employee__content--quote"><?php echo get_sub_field('quote', false); ?></p>
</div>
</div>
</li>
<?php $counter++; endwhile; ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment