WordPress.org

Forums

How to make next_post_link() and previous_post_link() works like this? (4 posts)

  1. Tunghsiao Liu
    Member
    Posted 8 years ago #

    I just want to make a navigation like this:

    <link rel="next" title="Next Post" href="<?php next_post_link(); ?>">
    <link rel="prev" title="Previous Post" href="<?php previous_post_link(); ?>">

    but once it was running it truned to:

    <link rel="next" title="Next Post" href="<a href="http://localhost/next-post/">Next Post</a> &raquo;">
    <link rel="prev" title="Previous Post" href="&laquo; <a href="http://localhost/previous -post/">Previous Post</a>">

    anyone?

  2. moshu
    Member
    Posted 8 years ago #

    That's wrong. Read the documentation.
    Template_Tags/next_post_link

    Who told you to put any anchor tags there?

  3. Tunghsiao Liu
    Member
    Posted 8 years ago #

    maybe i want a function like these:

    http://codex.wordpress.org/Template_Tags/next_post
    http://codex.wordpress.org/Template_Tags/previous_post

    i used these in version 1.5 and these codes worked well:

    <link rel="next" title="Next Post" href="<?php next_post(); ?>">
    <link rel="prev" title="Previous Post" href="<?php previous_post(); ?>">

    but now they're deprecated. so i want to find a replacement but the new functions don't work when i use next_post_link and previous_post_link like that, any idea?

  4. peiqinglong
    Member
    Posted 8 years ago #

    Maybe try this? <?php posts_nav_link(' - ','&larr; Previous Articles','Next Articles &rarr;'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.