WordPress.org

Forums

Change default number of posts for archive.php? (2 posts)

  1. mhains
    Member
    Posted 6 years ago #

    In the reading panel I've set the number of posts to 5, but in an archive.php view I've compressed the output -- so I'd really like to see 30 posts retrieved.

    I've put the query_posts(showposts=30) before the loop, but it's now ONLY showing the first 30 posts, even after I click the "previous" button to view more.

    How do I get the archive.php to ignore the default number of posts to show?

    thanks!

  2. Glenn Ansley
    Member
    Posted 6 years ago #

    I've done this before but I don't have the code in front of me right now so this may contain errors. Try it and let me know.
    add the following above query_posts(showposts=30)
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    Then change your query_posts to
    query_posts('showposts=30&paged='.$paged);

Topic Closed

This topic has been closed to new replies.

About this Topic