WordPress.org

Support

Support » How-To and Troubleshooting » Custom post type single template next & previous post links problem

Custom post type single template next & previous post links problem

  • Hi all,

    I have a custom post type set up named ‘projects’. The CPT has a rewrite rule on it to change the slug for the custom posts to ‘portfolio’.

    archive-projects is set up, so far so good. However I am having issues with adding previous and next post links to the single-projects.php template. The main issues so far are:

    note: the page is currently set up with a standard if, while, have posts php call.

    1) When I use the next_post_link or previous_post_link calls, no links show up at all.
    2) If I use previous_post or next_post then the links show up, but on the first post both links show the 2nd post in the queue.

    Ideally I’d like the first post to only show and next post link and the last showing a previous only, with all the posts in between showing both.

    Can anyone help me here please? All other discussions I’ve seen on the web don’t work and I’m starting to pull my hair out!

    Kind regards,

    Adam.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom post type single template next & previous post links problem’ is closed to new replies.