WordPress.org

Ready to get started?Download WordPress

Forums

Excerpts with thumbnails for older posts? (2 posts)

  1. thestylistquo
    Member
    Posted 6 months ago #

    I've been poring over anything I can find to help me with this, but I haven't found anything thus far that makes much sense to me. I'm about to pull out my hair!.. more.

    I'd like to be able to show only my most recent post in full, followed by excerpts of my older posts with thumbnails. A good example of what I'd like mine to look like is:

    http://www.theendlessmeal.com

    My site is The Stylist Quo and I'm using a child theme.

  2. nomdecode
    Member
    Posted 6 months ago #

    You can simply use a boolean in your loop to test if it is the first post :

    Find this:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    and replace it with:

    <?php if ( have_posts() ) : $first=true; while ( have_posts() ) : the_post(); ?>

    You can then display the content or the excerpt (and other different markup) depending on the $first value:

    <?php if ($first) { $first=false; the_content(); } else the_excerpt(); ?>

Reply

You must log in to post.

About this Topic