Support » Fixing WordPress » Show content of first post, display the rest differently

  • I’ve been chewing on a use of the Loop for several days and haven’t had much luck.

    I want to show the first post’s content, and the remaining index posts as just the title, or excerpt.

    Looking at using multiple loops, and the examples in the codex, I can do this easily when stating the category. There’s a great example there, and this works fine.

    Looking at other resources, like ‘$first=true’ it seems just out of reach.

    Is there a simple conditional where I could state:
    if this is the first post: show content
    else do something else

    Seems like it should be a snap, but somehow when addressing the entire blog’s posts the examples are limited, and I am certainly not enough of a coder to exrapolate.

    Can someone point me in the right direction please?

Viewing 4 replies - 1 through 4 (of 4 total)
  • This is what you are looking for!

    Birger 🙂

    Well that certainly is simple to add into the loop.

    But naturally I’m a little confused…

    if ($loopcounter % 2==0)

    I’d like it to allow a piece of the loop’s display to enter into the equasion for only the first post:

    an example:

    if ($loopcounter %1==0) {
    Do this in the loop
    Do that in the loop

    So that only the first post (post number one) shows the_content
    and the remaining 24 index entries only show the_title

    What am I doing wrong?

    Ok, I sorted it out…

    Here’s what I came up with:

    if (have_posts()) : while (have_posts()) : the_post(); $loopcounter++;

    if ($loopcounter == 1) {

    Do your thing

    } else {

    Do something else

    And it’s working just fine…

    Thank you!

    Just glad to help 😀

    Birger 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show content of first post, display the rest differently’ is closed to new replies.