The Loop is PHP code used by WordPress to display posts. It is how the loop is described in the WordPress Codex. Any HTML or PHP code in the Loop will be processed on each post, it is also stated in the same page. But is this 100% true? Do all posts need to look the same or have the exact same elements in the loop? No it doesn't. And in fact, any custom HTML or PHP can be rendered individually in the loop quite simple.
But why would you want to do this? Let's say you want to display an advertisement (an Adsense Ad for example) only after the third post in the loop. Or, you want to have a custom featured image for the first post, a different image size for the second and third post and, another image size for the rest of the posts. This is what I did in this WordPress theme. Of course, each type of posts have custom HTML IDs and different CSS styling. [Read more...]