first post styled different from rest
-
[In reference to https://www.ads-software.com/support/3/16724 ]
Ok, so I have been thinking for a while now how to style the first post differently from the others by keeping track of a counter variable. And I tried implementing a counter and such. But, my new problem lies in the foreach loop:
<?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
Even with a counter, how am I supposed to differentiate the first post from the rest uniquely so my 2nd loop (or run through) after incrementing the counter, only goes through the remaining posts, excluding the first post. My problem is (a) with the foreach loop and (b) uniquely separating the first post from all others.
I understand this is more of a programming/logic question, than a how-to regarding wordpress. Please bare with me here. I think this would be a neat feature out of the box for future releases. So, to get this hacked for the current version would be really awesome. I guess somehow I would need to run a for (not foreach) loop for the first post, and then run a foreach loop for the remaining posts. But, again how would I differentiate the first post from the rest so that the 2nd loop excludes the first post. Somehow I’m going to have to possibly incorporate the_ID function. Right now I’m just thinking aloud and writing my thoughts. Any advice would be welcome. Thanks!
- The topic ‘first post styled different from rest’ is closed to new replies.