WordPress.org

Ready to get started?Download WordPress

Forums

limiting posts display (3 posts)

  1. edfladung
    Member
    Posted 9 years ago #

    Hi Guys,

    I have a wp blog I'm setting up here: mosbef.com

    I have the "display posts" pref set to 100, in options. so that every post shows up in it's proper category page (my posts are images). But since the display posts option is such a high number, on the index page of the blog it lists every post. that is a large number of photos. What I'd like to do is to limit the post display to 10 posts, but only on my index page.

    Is it possible to pass a variable to the have_posts function that limits the wp loop to, let's say, 10 iterations?

    like this maybe: <?php if (have_posts('10')) : ?>

    obviously I've tried this and it doesn't work. anyone got any ideas?

    thanks in advance

    Update: Ok so i found a thread on Single Post Homepages and this seems to answer my question. or at least it works great. if anyone has any more info please leave it here, for my own benefit as well as the benefit of people trying to do something similar down the road. thank you!

  2. Kafkaesqui

    Posted 9 years ago #

    There's a couple plugins that make it easy to manage posts per page based on query type (i.e. category, archive, etc):

    http://mattread.com/archives/2005/03/custom-query-string-plugin/
    http://rephrase.net/miscellany/05/perpage.phps

    (2nd is a sort of update of the one shown in your forum link above)

  3. njbair
    Member
    Posted 8 years ago #

    Here is something I do in order to show the first full posts, and then excerpts of the other 9. This is in WP 1.51.

    <div class="entry">
    <?php
    $number_of_posts++;
    if ($number_of_posts > 1) { echo the_excerpt(); }
    else { echo the_content('Read the rest of this entry &raquo;'); }
    ?>
    </div>

Topic Closed

This topic has been closed to new replies.

About this Topic