Return to Snippet

Revision: 35384
at November 7, 2010 03:29 by ebiansyah1402


Updated Code
//append odd/even classes to post_class function
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';

Revision: 35383
at November 6, 2010 08:13 by ebiansyah1402


Initial Code
//append odd/even classes to post_class function
function oddeven_post_class ( $classes ) { 
   global $current_class;
   $classes[] = $current_class;

   $current_class = ($current_class == 'odd') ? 'even' : 'odd';

   return $classes;
}
add_filter ( 'post_class' , 'febripress_post_class' );
global $current_class;
$current_class = 'odd';

Initial URL

                                

Initial Description

                                

Initial Title
WP append odd & even class to WordPress body_class

Initial Tags
wordpress

Initial Language
PHP