Front page excerpts, latest story all displayed, etc. (3 posts)

  1. Popo
    Posted 11 years ago #

    I would like to modify my WordPress front page, so that the excerpts for posts are displayed for every post, except for the latest (current) post. The newest post would be displayed in its entirety, and the rest would be excerpts. I would also like to set it to display the last 50 posts, rather than the last 10.

    I did see a method of displaying excerpts on the front page, but it didn't seem to include displaying only the latest story in its entirety.

    Please help me. The more specific, the better, as I know very little when it comes to PHP. I would greatly appreciate the help, and I am using the Kubrik theme. Thanks.

  2. amory
    Posted 11 years ago #

    This codex article exemplifies how to use multiple loops where you would have one loop to show the latest post, and another to show the latest 50 excerpts.

    I would however say that i would not stay too long on a website with 50 excerpts on the main page. Too many in my opinion.

    It's late here - i can provide specific code if you need further help in the morning.

  3. amory
    Posted 11 years ago #

    This should do it. The second loop may not get all 50 excerpts if your post_per_page option is set to 10 as you stated, as I didn't have 50 posts to test with.

    <?php query_posts('showposts=1'); ?>
    <?php if (have_posts()): ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php else : ?>
    <?php endif; ?>

    <?php $posts = get_posts('numberposts=50&offset=1'); foreach ($posts as $post) : ?>
    <?php the_excerpt(); ?>
    <?php endforeach; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.