Skip to content

Instantly share code, notes, and snippets.

@Coop920
Created April 9, 2018 15:36
Show Gist options
  • Save Coop920/024217fb41998f76cdff19658bc24693 to your computer and use it in GitHub Desktop.
Save Coop920/024217fb41998f76cdff19658bc24693 to your computer and use it in GitHub Desktop.
3 Column Logic
<div id="stat-wrapper">
<?php if ( have_rows( 'stats' ) ) : ?>
<?php $count = 0; ?>
<div class="col">
<?php while ( have_rows( 'stats' ) ) : the_row(); ?>
<?php $count++; ?>
<div class="stat">
<?php if ( get_sub_field( 'stat_icon' ) ) { ?>
<img src="<?php the_sub_field( 'stat_icon' ); ?>" />
<?php } ?>
<?php the_sub_field( 'stat_headline' ); ?>
<?php the_sub_field( 'stat_copy' ); ?>
</div>
<?php
if($count % 2 == 0) { echo "</div><div class='col'>"; }
?>
<?php endwhile; ?>
<?php else : ?>
<?php // no rows found ?>
<?php endif; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment