WordPress Even odd Post Logic

WordPress Even odd Post Logic

<?php while (have_posts()): the_post() ?>
<?php if ($wp_query->current_post % 2 == 0): ?>
even
<?php else: ?>
odd
<?php endif ?>
<?php endwhile ?>

One thought on “WordPress Even odd Post Logic

Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

*

*