Customizing the first Post (3 posts)

  1. krugerusa
    Posted 10 years ago #

    I want to customize the first post on my blog to look differntly than the others. Basically I need to pull the first post from the loop apply some type of "What' new" styling and then proceed with displaying the remainder of the loop. Any ideas? This would be on the home page.

  2. Beel
    Posted 10 years ago #

    Add a type of counter, something that has been discussed quite often here for comments and posts. Set a variable to true before the loop and at the end set it to false, then test for the variable and display the necessary styling. The first time it is true and then all other loops it is false.

  3. davidchait
    Posted 10 years ago #

    If you look for some of my initial posts about placing adsense ads between posts (like CG-Inbetween now does), Beel is right, there's a bunch of code samples for how to set a counter and do something special before/after/around a given post.

    all you need to do for the first post is set a flag outside the loop to true, clear it after each post (redundant but easier), and where the post div is output also insert id="firstpost" or something like that.


Topic Closed

This topic has been closed to new replies.

About this Topic