• Resolved stabani

    (@stabani)


    i’m trying to make a theme for my site which makes the most latest post show the content while the older ones show the excerpt.

    any idea on how to do this?

Viewing 9 replies - 1 through 9 (of 9 total)
  • You shoud probably read about the examples of multiple loops here http://codex.wordpress.org/The_Loop .

    You don’t need multiple loops in the slightest. What you WOULD need is to customize the loop in your index.php, and have it output the_content for just the first on the page, and the_excerpt for all others. Just set a variable/flag to false outside the loop, and once you’ve processed one post with the_content set the variable to true, and then testing the variable from then on should always output the_excerpt.

    Yep, you need to know some PHP to do this… 😉

    -d

    Thread Starter stabani

    (@stabani)

    they are both on the same page… aka

    post1: content
    post2: excerpt
    post3: excerpt
    and so on. all on the same page

    Thread Starter stabani

    (@stabani)

    i am wondering if it is possible to use the loop counter perhaps, using if/else statements

    (inside the loop, add the following)

    ‘<?php if ( $postCount=1 ) { ?>
    <div class=”content”>
    <?php } else { ?>
    <div class=”excerpt”>
    <?php } ?>’

    ofcourse, adding the necessary template tags.

    would that work?

    Thread Starter stabani

    (@stabani)

    ok, i can understand how to use multiple loops, but how do you make the second loop not show the latest post?

    Thread Starter stabani

    (@stabani)

    this code seems to work:

    <?php if ( $postCount == “1” ){ ?>
    add relevant tags and formatting for the first post here
    <?php } else { ?>
    the relevant tags and formatting for the others.
    <?php } ?>

    any thoughts or suggestions otherwise?

    Nope, that’s exactly what I was suggesting. That is the way to go, not multiple loops — there’s no need, as you probably figured out. 😉

    -d

    Thread Starter stabani

    (@stabani)

    thanks david and moshu! Working now. Thanks a million, you solved a major peice of the puzzle.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘post wizardry’ is closed to new replies.