This members-only tutorial provides the steps to set up links to previous and next posts on single posts whilst ensuring that
- if there is no previous post, the first post is shown and
- if there is no next post, the last post is shown
essentially for an infinite looping of adjacent posts.
For example, given these posts:
when Post 3 is being viewed, the previous post would be Post 2 and the next would be Post 4.
when Post 4 is being viewed, the previous post would be Post 3 and the next should be Post 1 and not blank.
and when Post 1 is being viewed, the previous post should be Post 4 and not blank and the next would be Post 2.
While the tutorial has been written for Oxygen, the instructions can be used in any WordPress site.
Edit the Template that applies to singular posts.
Add a Code Block and set its width to 100%.
Give it a class of
PHP & HTML:
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $499 one-time).
Already a member? Log in below or here.