Skip to content

Instantly share code, notes, and snippets.

@Quasimo
Created January 18, 2013 05:17
Show Gist options
  • Select an option

  • Save Quasimo/4562515 to your computer and use it in GitHub Desktop.

Select an option

Save Quasimo/4562515 to your computer and use it in GitHub Desktop.

Revisions

  1. Quasimo created this gist Jan 18, 2013.
    11 changes: 11 additions & 0 deletions wp-oddeven
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    <?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';
    ?>