Skip to content

Instantly share code, notes, and snippets.

@aaronhartland
Created May 27, 2013 04:11
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 aaronhartland/5655161 to your computer and use it in GitHub Desktop.
Save aaronhartland/5655161 to your computer and use it in GitHub Desktop.
Genesis - add odd/even post class
<?php
//* Add odd/even post class
function sample_oddeven_post_class ( $classes ) {
global $current_class;
$classes[] = $current_class;
$current_class = ($current_class == 'odd') ? 'even' : 'odd';
return $classes;
}
add_filter ( 'post_class' , 'sample_oddeven_post_class' );
global $current_class;
$current_class = 'odd';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment