• Resolved dorofeevdima

    (@dorofeevdima)


    Hi all,

    I’m trying to fix an error with pagination of WP page Navi plugin. After I’ve added posts_per_page parameter to the query I’m getting 404 error when clicking on link page3,4 etc (there are 10 records totally) and after page 8 (where there around 60 records totally). Without this parameter it works fine but I want to display various number of posts under categories.

    Here is the code of one of the pages I’m trying to fix:

    $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
    query_posts($query_string .’&posts_per_page=5&paged=’ . $paged);
    ?>

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    • “><?php the_title(); ?>
    • <?php endwhile; ?>
      <?php else : ?>
      <?php _e(‘Sorry, no posts matched your criteria.’); ?>

      <?php endif; ?>

      <?php if (function_exists(‘wp_pagenavi’)){ wp_pagenavi(); } ?>

      Any help is much appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter dorofeevdima

    (@dorofeevdima)

    Finally, I’ve found an answer. Not sure if it’s specific in my case or it’s a general WP issue but default value for posts per page set up in WP admin (General > Reading > Maximum number of posts per page) should be less than value for posts_per_page parameter for custom query. In my case, I’ve changed in WP options value to 3 and for other page changed this to 5 and all working fine now!

Viewing 1 replies (of 1 total)
  • The topic ‘WP page navi. 404 error’ is closed to new replies.