Pagination not working on archive.php template?

Question

I have an archive.php template which I only use for the blog.

The code goes a bit like this:

<?PHP
  $the_query = new WP_Query( array(
    'posts_per_page'=>9,
    'post_type'=>'blog',
    'paged' => get_query_var('paged') ? get_query_var('paged') : 1) 
   ); 
?>

<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

Title, text, etc pulled through

<?php endwhile; ?>

<?php
    $big = 999999999; // need an unlikely integer
    echo paginate_links( array(
        'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $the_query->max_num_pages
    ) );
?>

<?php wp_reset_postdata(); ?>

But then I go to Page 2, my 404 page displays instead.

0
M.T 2 months 0 Answers 9 views 0

Leave an answer