I have a custom post type - let's assume it's called fruit
If I then have a list of fruits, ordered by date:
Apple
Orange
Mango
Pineapple
Orange
If I load the Mango page for example via single.php I want to know whether it's an odd or an even post so I can use some slightly different CSS classes in the template.
I could get all posts of type fruit in date order and cycle through them to find this out, but this seems incredibly wasteful.
Is there a better way?
Aucun commentaire:
Enregistrer un commentaire