Created
April 10, 2019 17:31
-
-
Save Asikur22/b383456e9fae7fd0823c98366abb282a to your computer and use it in GitHub Desktop.
[Add “odd” “even” Class Name to “post_class”] #WordPress
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
/* | |
* Add "odd" "even" Class Name to "post_class" | |
*/ | |
function odd_even_post_class( $classes ) { | |
global $oddeven_class; | |
$oddeven_class = ( $oddeven_class == 'odd' ) ? 'even' : 'odd'; | |
$classes[] = $oddeven_class; | |
return $classes; | |
} | |
add_filter( 'post_class', 'odd_even_post_class' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment