laurenclark
8/20/2014 - 12:29 PM

Custom Fields - Alternating Layout Boxes

Custom Fields - Alternating Layout Boxes

//Requires Advanced Custom Fields PLugin and Custom Post Types UI
//Use <?php the_field('field_name') ?> to insert the fields into block.

<?php 
$args = array(
	'post_type' => 'your_custom_post_type',
	'orderby' => 'date',
	'order' => 'ASC',
	);

$reference = new WP_Query( $args );

?>

<?php /* Start loop */ ?>
<?php if ( have_posts() ) { ?>
<?php while ( $reference->have_posts() ) { ?>
<?php $staff->the_post(); ?>
<?php if (0 === $reference->current_post %2 ) { ?>

<!-- do stuff for odd post -->
<!-- ODD -->

<section class="odd-box">
	<div class="row">

	</div>
</section>


<?php continue; ?>
<?php } ?>

<!-- do stuff for even posts -->

<!-- Even -->
<section class="odd-box">
	<div class="row">

	</div>
</section>

<?php } ?>
<?php } ?>

<?php /* End Loop */ ?>