• Say I want to style posts with a different background color depending on whether they’re odd or even. I’m thinking, in terms of pseudo-code, something like this:

    if ((post-id % 2) == 0)
        <div class="even">
    else
        <div class="odd">

    But how do I do this in a PHP WordPress template?

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Styling odd and even numbered posts differently’ is closed to new replies.