Posted By

ebiansyah1402 on 11/06/10


Tagged

wordpress functionsphp


Versions (?)

WP append odd & even class to WordPress body_class


 / Published in: PHP
 

  1. //append odd/even classes to post_class function
  2. function oddeven_post_class ( $classes ) {
  3. global $current_class;
  4. $classes[] = $current_class;
  5.  
  6. $current_class = ($current_class == 'odd') ? 'even' : 'odd';
  7.  
  8. return $classes;
  9. }
  10. add_filter ( 'post_class' , 'oddeven_post_class' );
  11. global $current_class;
  12. $current_class = 'odd';

Report this snippet  

You need to login to post a comment.