Style posts differently with a counter

You can add different classes to your posts within the loop so that you can style them differently. A good example would be that you have 3 posts on a line where the last post needs a margin of 0 to line up with the edge of the container. Or, style every other one or every third one a different color. Choices are limitless. You can change the number below to target which posts you want to style differently.

 

Here is an example of a normal loop and styling every other post:

 

Here is an example of a Custom Query when viewing a Custom Taxonomy and styling every third post:

 

Leave a Reply

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

− 3 = 1