How to tell if a post is odd or even?
-
I want to format a list of posts in a loop. Odd posts will be formatted one way and even posts another way.
I have set up an If/Else using this:
<?php if (($wp_query->post_count) % 2) : ?>
That doesn’t work though. How can I set a IF statement to say basically IF the post count is odd do this Else do this?
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How to tell if a post is odd or even?’ is closed to new replies.