Support » Fixing WordPress » Wrong post count in pagination

  • I want to show on my main page post from only one category so I wrote something like this in index.php:

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

    but limitation in_category() inside the loop cause problem with post counting. posts_nav_link() on last page show “next page>>” like it should be next page witg post but it isn’t. On click on “next page>>” empty page is showing. I am sure this is caused by counting posts witch are not in category limited by in_category().
    How should I wrote loop to posts_nav_link work correctly.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Wrong post count in pagination’ is closed to new replies.