Forked from Coop920/gist:024217fb41998f76cdff19658bc24693
Last active
April 9, 2018 16:42
-
-
Save LiamBailey/80421d5dfb03345181950dc9482ec393 to your computer and use it in GitHub Desktop.
3 Column Logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="stat-wrapper"> | |
<?php if ( have_rows( 'stats' ) ) : ?> | |
<?php $showitems = 2; $i = 0;$maincount = 0; ?> | |
<div class="col"> | |
<?php while ( have_rows( 'stats' ) ) : the_row(); ?> | |
<div class="stat stat-<?php echo $maincount; ?>"> | |
<?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 $i++;$maincount++; ?> | |
<?php if ($i == $showitems && $maincount < 5) { | |
$showitems = $showitems == 2 ? 1 : 2; | |
?></div><!-- end .col //--><div class="col"><?php | |
$i = 0; | |
} | |
endwhile; ?> | |
</div><!-- End .col //--> | |
<?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