WordPress.org

Ready to get started?Download WordPress

Forums

next_post_link & previous_post_link gives me the same post ! (7 posts)

  1. diascodes
    Member
    Posted 1 year ago #

    Hi guys,
    I have a serious problem with those functions, I used it on one of my themes and everything is fine on some posts, but once the user is in the final post for example, or the newest post, he got the same post as a next & previous post,
    please if someone has a solution for this case I'll appreciate his help =) ,
    Thanks a lot

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Isn't this supposed to happen if you're on the final post, there wouldn't be any further posts?

  3. diascodes
    Member
    Posted 1 year ago #

    Hey andrew,
    I don't think so, it should at least hide one of the links, not ?

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    It doesn't by default hide one of the links.
    Here's a similar thread
    http://wordpress.org/support/topic/display-next-post-link-only-if-there-is-a-next-post?replies=3

  5. diascodes
    Member
    Posted 1 year ago #

    even this doesn't seems to be working, I tried it :( and still showing the same post in both links (next & previous), is there a way to get the id of the next or previous post ?

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

  7. diascodes
    Member
    Posted 1 year ago #

    Yes, but it doesn't work too
    the problem is that the varliables $prev_post & $next_post both has the same values, $next_post->ID == $prev_post->ID

Topic Closed

This topic has been closed to new replies.

About this Topic