WordPress.org

Forums

[resolved] Changing next and previous post links (2 posts)

  1. CSSgirl
    Member
    Posted 3 years ago #

    Hello!

    I'm currently working on a single page site where we are going to have a "News" section that is horizontally scrollable. What I have now is the main page, which displays a listing of the 3 most recent posts. Clicking on the link moves the page to the left and the posts chosen replaces the listing of posts.

    What I want to do is add next and previous links to this.

    I can't use next_post() since it's the single page permalink - and in this case we have all of our content on one page.

    So what I want to do is control the next and prevous links and have them link to the post using the post id like so: <a href="#post-34"> instead of <a href="mysite.com/post-34">

    Also, it will need to work within a custom query - you can view the code controlling the sections here:

    http://pastebin.com/Y35ie59k

  2. CSSgirl
    Member
    Posted 3 years ago #

    Hello all I have I found a solution with the help of a fellow forrst member.

    You can view the code here:

    http://pastebin.com/4AY7dFcN

    Also, I've implemented code to change the link on the previous link on the first post, and hide the next link on the last post.

    Hope this can help someone else in the future!

    -Lindsey

Topic Closed

This topic has been closed to new replies.

About this Topic