'Next page' showing same posts (3 posts)

  1. djprozac
    Posted 8 years ago #

    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?

  2. nathanrice
    Posted 8 years ago #

    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.

  3. djprozac
    Posted 8 years ago #

    Thanks! I will try that!

Topic Closed

This topic has been closed to new replies.

About this Topic