Support » Fixing WordPress » Page Navigation Not Working – Help!

  • Resolved korereactor


    I’m running WordPress, and for some reason my page navigation using posts_nav_link() isn’t working right. The nav links work and show up, however, the correct previous posts are not being displayed. See here:

    If you look at my archives you’ll note the posts that are displaying on page 2 are not correct. I’m really not sure why it’s not working right. I do have it set to display 10 posts per page in the options tab. Anyone ever see anything like this before? Any help would really be appreciated! (Note: I have removed the navigation links for now as they were not functioning properly)

Viewing 5 replies - 1 through 5 (of 5 total)
  • Is there a chance you’re using some form of post query (query_posts or get_posts) to initialize the main post loop? And if so, what’s the code look like?

    Yes I am. Here’s the code:
    <?php $posts = get_posts('numberposts=10'); foreach ($posts as $post) : setup_postdata($post); ?>
    <img src="<?php bloginfo('url'); ?>/images/list.gif" width="5" height="6" border="0" alt="Latest Article" title="Latest Article" />&nbsp;<a href="#post-<?php the_ID(); ?>"><?php the_title(); ?>...</a>
    <?php endforeach; ?>

    The above code is located before the folowing code for the main posts:
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    I now recall the top get_posts from another thread. Perhaps if we change it ever so slightly to make sure there’s no conflict with the default $posts object on the page:

    <?php $latest_posts = get_posts('numberposts=10'); foreach ($latest_posts as $post) : setup_postdata($post); ?>

    I’ll try that and see how it goes. Thanks.

    Fixed. Thanks again for all your help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Page Navigation Not Working – Help!’ is closed to new replies.