Support » Themes and Templates » Showing ALL posts in archive (no pages)

  • Resolved sargant


    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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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.

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

    Nevermind, crisis averted.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing ALL posts in archive (no pages)’ is closed to new replies.