WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: WP-Pagenavi] Showing too many pages with custom loop. (3 posts)

  1. grahampaterson
    Member
    Posted 3 years ago #

    I've looked into it and there are a lot of posts about custom loops and pagination, but I can't seem to find a solution that works for me.

    My problem is that on my home/index page I exclude a category but WP-Pagenavi still calculates as if the posts are included, showing blank pages. You can see an example here all the pages after 10 are blank (sorry if the site is slow, I think it's host side).

    Anyway, I'm not great at php and I'm fairly new to WordPress so I may be missing something glaringly obvious. Here's my current code

    <?php global $query_string;
    		query_posts('cat=-228' . '&paged=' . get_query_var('paged')); ?>
                  <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

    and the full code is here if that's not enough

  2. scribu
    Member
    Posted 3 years ago #

    This is happening because you're calling wp_reset_query(), so PageNavi ends up with the parameters in the second loop.

  3. grahampaterson
    Member
    Posted 3 years ago #

    Ah thanks scribu, I did manage to figure out that pagenavi code was in the wrong place so just put it in the right loop and it works fine (no idea what the second loop is for in the template but oh well)

Topic Closed

This topic has been closed to new replies.

About this Topic