Support » Fixing WordPress » Next/Previous links

  • I am trying to get “Next and Previous” links at the bottom of my index page. I am using this code
    < ? php next_posts_link(‘« Previous Entries’) ? >
    < ? php previous_posts_link(‘Next Entries »’) ? >
    The links will not show up. what am i doing wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
  • I have found that because of the floating style that is applied to both of these, sometimes you need to put a non-breaking space between them:

    Hmmm. Looks like your problem might that the tags have been rewritten. Try using this:

    <?php previous_post_link('&laquo; %link') ?>
    <?php next_post_link('%link &raquo;') ?>

    Yea, i have tried that too, still did not work. Here is the code, maybe someone can see what i am doing wrong:
    < ? php endwhile; ? >

    <span class=”next”>< ? php previous_posts_link(‘« %link’) ?></span>
    <span class=”previous”>< ? php next_posts_link(‘%link »’) ? ></span>

    < ? php else : ?>

    < h2 class=”center”>Not Found< /h2>

    <p class=”center”>Sorry, but you are looking for something that isn’t here.</p>

    < ? php include (TEMPLATEPATH . “/searchform.php”); ? >

    < ? php endif; ? >
    I have included the top of the code to the bottom of the code to make sure i am placing the next/previous php in the right spot of the index.php file
    EDIT-the link is if someone wanted to look at the source. I also made entries in my css file for the span

    Can anyone help with this?

    First try fixing the spacing in the php code and also add a semi-colon to the end:

    <?php previous_posts_link(‘« %link’); ?>
    <?php next_posts_link(‘%link »’); ?>

    Next, try these functions instead:

    <?php previous_post(‘« %link’); ?>
    <?php next_post(‘%link »’); ?>

    You could also try this single function to replace the two above:

    <?php posts_nav_link(‘ ‘,’« %link’,’%link »’); ?>

    And lastly you could try removing all the above and instead replacing it the wp-pagenavi plugin, which does a much better job than any of the above functions.

    Next, try these functions instead:

    <?php previous_post(‘« %link’); ?>
    <?php next_post(‘%link »’); ?>

    WRONG advice:
    1. they are deprecated
    2. they were for single post view, not for index (or other multipost view pages)

    Ooops.. sorry!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Next/Previous links’ is closed to new replies.