Post Navigation Element Question (Loop to first or last post)

Hey All,

I am using the post navigation to link to previous and next posts. However when I reach the end or start of the posts it only provides me with one link (either next on the first post, or previous on the last post). I would prefer them to loop, so that when you reach the first post, you can click to view the last post, and visa versa. Is there an easy way to do this or will this take some additional customization?

Thanks!

Hello @michigancreative,

Thanks for writing in!

What you have in mind is not the way the Post Navigation element works. Be advised that this element is just using the default WordPress post navigation turn into an element for the builder. The post navigation is using the posts_nav_link() (https://developer.wordpress.org/reference/functions/posts_nav_link/) which displays the post pages link navigation for previous and next pages. When you reach the very first post or last post, you will always have one link. The post navigation will not loop to the very end or start of the items.

What you have in mind, the looping of the post navigation items could be possible with custom development, but this would be outside the scope of support we can offer. You may wish to consult a developer to assist you with this.

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third-party developer.

Thanks for understanding. Take care!

Hey Ruenel,

Thanks so much for your response. I was actually able to figure out a solution that will work for now. I just added some conditions to a row of buttons at the bottom of the posts, two of which were set to link to the previous and next posts, and then 2 other buttons were added to only be visible when on either the last or first post to link back to the first or the last. It works for now, but wont exactly work if more posts are added.

Thanks!

Hi @michigancreative,

We’re glad that you’re able to find alternative solutions. If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

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