Forums

[resolved] Current Post in full then Excerpts (3 posts)

  1. kespinoza
    Member
    Posted 2 years ago #

    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.

  2. Chris_K
    Member
    Posted 2 years ago #

    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.

  3. kespinoza
    Member
    Posted 2 years ago #

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

    <?php $postcount++; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.