WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Page Navigation Not Working - Help! (6 posts)

  1. korereactor
    Member
    Posted 8 years ago #

    I'm running WordPress 1.5.1.3, 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:

    http://www.korereactor.com/index.php/page/2

    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)

  2. Kafkaesqui

    Posted 8 years ago #

    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?

  3. korereactor
    Member
    Posted 8 years ago #

    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(); ?>

  4. Kafkaesqui

    Posted 8 years ago #

    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); ?>

  5. korereactor
    Member
    Posted 8 years ago #

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

  6. korereactor
    Member
    Posted 8 years ago #

    Fixed. Thanks again for all your help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.