Skip to content

Instantly share code, notes, and snippets.

@xhinking
Created January 16, 2013 06:03
Show Gist options
  • Save xhinking/4545012 to your computer and use it in GitHub Desktop.
Save xhinking/4545012 to your computer and use it in GitHub Desktop.
Give WordPress Posts An Even-Odd Class. via -> http://gregrickaby.com/2012/05/wordpress-posts-even-odd-class.html
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<div id="post-<?php the_ID(); ?>" <?php $even_odd = (++$j % 2 == 0) ? 'even-post' : 'odd-post'; post_class( $even_odd ); ?>
<p><?php the_excerpt(); ?><>
</div>
<?php endwhile; endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment