WordPress.org

Ready to get started?Download WordPress

Forums

Next/Previous links (7 posts)

  1. carnold
    Member
    Posted 7 years ago #

    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?

  2. Hulk
    Member
    Posted 7 years ago #

    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:
    &nbsp;

    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;') ?>
  3. carnold
    Member
    Posted 7 years ago #

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

    <span class="next">< ? php previous_posts_link('« %link') ?></span>
    <span class="previous">< ? php next_posts_link('%link »') ? ></span>
    </div>

    < ? 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; ? >
    /code
    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 http://www.mytimewithgod.net if someone wanted to look at the source. I also made entries in my css file for the span

  4. carnold
    Member
    Posted 7 years ago #

    Can anyone help with this?

  5. jsherk
    Member
    Posted 6 years ago #

    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.

  6. moshu
    Member
    Posted 6 years ago #

    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)

  7. jsherk
    Member
    Posted 6 years ago #

    Ooops.. sorry!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.