WordPress.org

Forums

WP-PageNavi
[resolved] WP Generating exactly 2x the number of pages it should (2 posts)

  1. ianarmstrong
    Member
    Posted 1 year ago #

    I'm guessing you've seen this before and there is a quick fix. I have a client site generating exactly 2x the number of pages that it should.

    My loop is pretty straightforward.

    <?php
    
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $archive = array(
    'post_status' => 'publish',
    'post_type' => 'post',
    'posts_per_page'   => 10,
    'order' => 'DESC',
    'orderby' => 'post_date',
    'paged' => $paged
    );
    
    global $posts_query;
    $posts_query = new WP_Query( $archive ); ?>
    
    <?php if($posts_query->have_posts()) : while($posts_query->have_posts()) : $posts_query->the_post(); ?>
    
        <?php // get post format and display template for that format
        if ( !get_post_format() ) : get_template_part('post-formats/format', 'standard');
        else : get_template_part('post-formats/format', get_post_format()); endif; ?>
    
    <?php endwhile; ?>
    <?php else : ?>
    
        <p class="no-posts"><?php _e('Sorry, no posts matched your criteria', 'example'); ?></p>
    
    <?php endif; ?>
    
    <?php if ( !is_singular() && !is_page() ) : ?>
        <aside class="row">
            <div class="<?php foundation_columns(12); ?>">
                <?php wp_pagenavi(); ?>
            </div>
        </aside>
    <?php endif; ?>

    http://wordpress.org/plugins/wp-pagenavi/

  2. Lester Chan
    Member
    Plugin Author

    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.