add odd or even class in wordpress loop using php

You can while loop for add odd or even class in loop.

$count=0;
while ( have_posts() ) : the_post(); 
	echo ($count % 2 ? "<li class='even'>" : "<li class='odd'>");
$count++;
endwhile; ?>

Share With Friends

Speak Your Mind

*

Time limit is exhausted. Please reload CAPTCHA.