WordPress.org

Support

Support » How-To and Troubleshooting » ‘Next page’ showing same posts

‘Next page’ showing same posts

  • Hey all,

    I configured the loop on my main index to show only one post from a certain category. However, when I now try clicking the ‘next page’ link outputted by posts_nav_link the same post comes up. Why doesn’t it show the next post in the same category?

Viewing 2 replies - 1 through 2 (of 2 total)
  • using query_posts to exclude/include categories will disable the paging feature. Instead of doing that, try this (forgive me if my syntax is a little off … this is off the top of my head):

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if (in_category('5')) { ?>
    
    <!-- Standard in-loop stuff -->
    
    <?php } ?>
    <?php endwhile; endif; ?>

    The if (in_category()) part checks to see if the post is in the category you specify before displaying the content of the post.

    Hope that helps.

    Thanks! I will try that!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘‘Next page’ showing same posts’ is closed to new replies.