Style Each Post Differently WordPress

by: John Surdakowski06/01/2013

Quick Summary I have been working on a Wordpress project that called for a few pretty custom requests. We needed to style the first two posts differently. We also needed to display multiple loops. One for the main blog feed and another feed in the sidebar based on a category.


Style Each Post Differently

I have been working on a WordPress project that called for a few pretty custom requests. We needed to style each post differently. (Well the first two at least) We also needed to display multiple loops. One for the main blog feed and another feed in the sidebar based on a category.

I figured I would share how to style each post differently. In another article, I will also explain how to display multiple loops.

If you want to target the first two posts, you’ll need to start a loop like so:

`

ID == $do_not_duplicate ) continue; ?>`

`

Do Something.

`

This will target the first two posts only. So you can add your content, title, html etc etc.. within that loop. And it will only be applied to the first two posts.

Now to target the rest:

`

ID == $do_not_duplicate ) continue; ?>`

`

Do Something

`

Within this loop, you can add different html and content. Using CSS you can target and style differently then the first two posts. Nifty, huh?

If you have questions about how to style each post differently – let me know in the comments.

Let's discuss your ecommerce goals

Schedule a consultation call with one of our experts.

CONTACT US
Let's discuss your ecommerce goals