Manually retrieve posts instead relying on the loop (2 posts)

  1. hinching
    Posted 10 years ago #

    I'm struggling last minute for CSS Reboot. I'm just wondering whether is there a way to retrieve posts for my index page so that I can retrieve the 1st post and then wrap it with custom css. And then retrieve the 2nd and 3rd posts and wrap them up with another custom css.

    Anyone mind pointing me to the right direction?

  2. eridan
    Posted 10 years ago #

    I'd probably add a counter in the loop, which is increased after each post. Then add something like:

    <?php if($counter == 1) {?>
    <div class="firstpost">
    <?php } else { ?>
    <div class="post">
    <?php } ?>

    And just style the .post and .firstpost in your stylesheet..`

Topic Closed

This topic has been closed to new replies.

About this Topic