Forums

Correct Pagination w/ PageNavi and query_posts (3 posts)

  1. drewbarden
    Member
    Posted 1 year ago #

    Ok. So I am having the problem outlined here—where I've got a different number of posts showing on the homepage than on the paged pages. The issue, is say I'm showing 6 posts on the homepage, and fifteen on all other pages. This means, each page has a 15-post offset. So on the second page, it assumes the homepage displayed 15 posts—where in fact it only displayed 6. The result is posts 7-15 are excluded altogether. Here is my code (not adapted from the above provided link):

    global $query_string;
    if (is_home()) :
    query_posts($query_string."posts_per_page=6");
    endif;

    As a note: I am using wp-PageNavi for my page navigation.

    I'm not entirely sure what to do. I tried WPEngineer's solution, but ended up with unexpected results. Help?

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    global $query_string;
    query_posts($query_string . "&order=ASC");
    When using query_posts in this way, the quoted portion of the argument must begin with an ampersand (&).

    http://codex.wordpress.org/Function_Reference/query_posts

  3. drewbarden
    Member
    Posted 1 year ago #

    Whoops, my mistake. Ok well that was a separate issue altogether—and somehow it wasn't affecting the output. The issue remains though, of the missing seven posts between the first page and the second.

Topic Closed

This topic has been closed to new replies.

About this Topic