How to alternate color for every other post?
-
I’m trying to alter my index.php so that every other post calls a variation of the .post class from the .css file, thereby allowing me to give a different colored background to alternating posts (similar to how this forum does).
So, I guess my question is this: is there a way to parse the ID number of the post, evaluate whether it is odd or even, and then call the .post class (say, .post1 or .post2) based on the results of the ID evaluation?
I think that I would need a PHP function that returns text of either <div class=”post1″> or <div class=”post2″> based on the results.
Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How to alternate color for every other post?’ is closed to new replies.