Infinite Next and Previous buttons to show posts on single posts

Hi,

I need to have an ‘infinte’ Next and Previous buttons to show posts on single posts. I came to this solution: https://theme.co/apex/forum/t/need-the-next-and-previous-arrow-buttons-to-show-posts-from-the-parent-category-page/23944 and it works fine, however, the following buttons came out empty:

  1. the first (latest) single post, the ‘Previous’ button came out empty
  2. the last (oldest) single post, the ‘Next’ button came out empty

I wanted to show links to post replacing the empty ones with:

  1. On the first (latest) single post, the ‘Previous’ button displays and links the oldest post
  2. On the last (oldest) single post, the ‘Next’ button displays and links the latest post

This would render the ‘Next’ and ‘Previous’ buttons infinite.

Looking from the provided solution above and looking for answers on the internet, I think it will need to have conditions similar to if(!empty($)), I’m not sure and I don’t know how to do it.

Can you help me with this please?

Thank you so much!

Hello There,

Thanks for writing in!

The default next and previous buttons will only link to the next post or previous post when viewing a current post. Please check out this codex: https://codex.wordpress.org/Function_Reference/get_adjacent_post

Regretfully, this particular customization request, having to have an infinite single pagination is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself. If you have any further questions about the theme, we are more than happy to provide you with assistance on these inquiries.

Thank you for your understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.