connect last post with first post

next/prev from my first to last and the other way around
cant find a solution for that
i am using this code for next

  <?php next_post_link('%link','<img src="https://wordpress.stackexchange.com/questions/259353/img-location"/>'); ?>

and this for prev

  <?php previous_post_link('%link','<img src="https://wordpress.stackexchange.com/questions/259353/img-location"/>'); ?>

here is the first post

1 Answer
1

You may install this plugin and then for the next link, use:

<?php c2c_next_or_loop_post_link('%link','<img src="https://wordpress.stackexchange.com/questions/259353/img-location"/>'); ?>

and for the previous link use:

<?php c2c_previous_or_loop_post_link('%link','<img src="https://wordpress.stackexchange.com/questions/259353/img-location"/>'); ?>

That’s it. Now the previous link of your first post should be the last post and the next link of your last post should be the first post.

If you don’t want to install any plugin, then you may follow the instructions from this post to see how it can be done with custom CODE.

Leave a Comment