WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Post #'s per page (4 posts)

  1. godzilla74
    Member
    Posted 5 years ago #

    Is there a way to have the amount of posts be a different amount depending on which page you are on?

    For instance, I only want 1 post to show on index.php, but I want 5 excerpts of the posts to show on archives.php.

    When I change the 'blog pages show at most' setting to 5, ALL the pages are affected (index.php & archive.php). Naturally, when it is at 1, all pages only show 1 post and I have to use prev_posts_link(), next_posts_link() and go through them one at a time.

    Thanks,
    Justin

  2. MichaelH
    Member
    Posted 5 years ago #

    In your archive template, just before your loop:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string . '&showposts=5&paged=' . $paged);
    ?>

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  3. godzilla74
    Member
    Posted 5 years ago #

    Worked like a charm! Thanks for the assist!

  4. jereruira
    Member
    Posted 4 years ago #

    Thanks for asking the question and many thanks for answering it. Took me one minute. Viva la search on wordpress.org.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags