Created
January 18, 2013 05:17
-
-
Save Quasimo/4562515 to your computer and use it in GitHub Desktop.
add to functions.php in wordpress theme. Add Odd/Even to Posts with post_class() http://wp-snippets.com/add-oddeven-to-posts/
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
| <?php | |
| function oddeven_post_class ( $classes ) { | |
| global $current_class; | |
| $classes[] = $current_class; | |
| $current_class = ($current_class == 'odd') ? 'even' : 'odd'; | |
| return $classes; | |
| } | |
| add_filter ( 'post_class' , '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