Skip to content

Instantly share code, notes, and snippets.

@dauble
Last active October 6, 2017 14:55
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/de5d78d1105dd672525fd9be86750b69 to your computer and use it in GitHub Desktop.
Save dauble/de5d78d1105dd672525fd9be86750b69 to your computer and use it in GitHub Desktop.
<ul class="employees__list">
<?php $counter = 1; ?>
<?php while(have_rows('employee')): the_row(); ?>
<li class="employees__list__employee<?php if($counter % 2 ==0){ echo ' even'; }?>">
<?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>
@dauble
Copy link
Author

dauble commented Oct 6, 2017

This resolves the problem:

                <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