• Resolved ianarmstrong

    (@ianarmstrong)


    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; ?>

    https://www.ads-software.com/plugins/wp-pagenavi/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘WP Generating exactly 2x the number of pages it should’ is closed to new replies.