WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Showing ALL posts in archive (no pages) (3 posts)

  1. sargant
    Member
    Posted 8 years ago #

    I'm trying to retrieve all posts in an archive page by putting this at the head of date.php:

    <?php query_posts($wp->query_vars->matched_query."&posts_per_page=-1"); ?>

    However, this is bringing up every single post, not just all those from the matched query. Is posts_per_page the wrong way of doing it?

  2. brittanie
    Member
    Posted 8 years ago #

    Try using one of my fav plugins, Custom Query String. Instead of the default setting where "show 10 posts per page" applies to EVERYTHING, this plugin lets you set a different number of posts per page for different situations (for example, all posts per month, but only 10 posts per page for categories and only one post per page for the index).

    To show all the posts per page, use -1 instead of an real number.

  3. sargant
    Member
    Posted 8 years ago #

    I've just realised that matched_query is a child of $wp directly and not query_vars. Oops.

    Nevermind, crisis averted.

Topic Closed

This topic has been closed to new replies.

About this Topic