• Resolved KB

    (@kespinoza)


    On my home page, I’d like to have my current post be in full then have the remaining posts show excerpts/summary. As of now I only know how to set it showing each post in full or each post as an excerpt.

Viewing 2 replies - 1 through 2 (of 2 total)
  • That’s not too tough with a small modification to The_Loop but the trick is making sure that you don’t do it to subsequent pages (like when folks navigate to older posts).

    In your theme’s index.php find
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    and add this right before that line:
    <?php $postcount = 0; ?>
    and add this right after that line:
    <?php $postcount++;

    Scroll down a bit to where your theme calls the_content() and replace that with something like this (keep in mind you might want to save your theme’s original the_content() line and replace it below):

    <?php if ($postcount == 1 && !is_paged()) : ?>
       <?php the_content(__('Read more'));?><div style="clear:both;"></div>
    <?php else : ?>
       <?php the_excerpt(); ?>
    <?php endif; ?>

    And there you go.

    Thread Starter KB

    (@kespinoza)

    Thanks Chris, that totally worked. I just needed to add the closing tag for the code postcount++

    <?php $postcount++; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Current Post in full then Excerpts’ is closed to new replies.