WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Show all posts without page navigation in archive.php (2 posts)

  1. Tunghsiao Liu
    Member
    Posted 3 years ago #

    Hi all, I tried to display all posts with without pages in archive.php. I used posts_per_page=-1 but it displayed all the posts on my site, anyone has good ideas?

  2. vtxyzzy
    Member
    Posted 3 years ago #

    It sounds like you did not retain the original query arguments. Here is the way to override the pagination while keeping the original arguments:

    global $wp_query;
    query_posts(
        array_merge(
            $wp_query->query,
            array('posts_per_page' => -1),
        )
    );

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags