Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created February 17, 2014 20:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/9058698 to your computer and use it in GitHub Desktop.
Save billerickson/9058698 to your computer and use it in GitHub Desktop.
<?php
function be_custom_loop() {
$loop = new WP_Query( $args );
if( $loop->have_posts() ): while( $loop->have_posts() ): $loop->the_post();
$classes = 0 == $loop->current_post || 0 == $loop->current_post % 2 ? 'one-half first' : 'one-half';
echo '<div class="' . $classes . '">' . get_the_title() . '</div>';
endwhile; endif; wp_reset_postdata();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment