Support » Themes and Templates » TwentyTen – Alternating post colour

  • Resolved axim30

    (@axim30)


    I used to have code underneath in the loop to get alternating colours for my posts, by styling ‘post odd’ and ‘post even’.

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>  
    
    <div class="post <?php echo $odd_or_even; $odd_or_even = ('odd'==$odd_or_even) ? 'even' : 'odd'; ?>" >

    Now TwentyTen is using the post_class() function, so how can I do this?
    Generating a <div> around the post_class() is possible but not very elegant, can I easily add this to the post_class?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘TwentyTen – Alternating post colour’ is closed to new replies.