I tried to get the next and previous URL, and create a navigation. But it seems to only retrieve the permalink from the two first posts (but not the others recents posts).
I have 5 posts (ID = 25, 86, 80, 75, 45). When I am on the first post (ID = 25) and I click on previous post, I am going to post ID = 45, and after when I click on previous it stay on the same page.
<?php if (have_posts()) : while (have_posts()) : the_post(); $prev = get_permalink(get_adjacent_post(false,'',false)); $next = get_permalink(get_adjacent_post(false,'',true)); ?> <li class="post-link"> <a class="prev" href="<?php echo $prev; ?>"> <span class="icon-prev"></span> </a> </li> <li class="post-link"> <a class="next" href="<?php echo $next; ?>"> <span class="icon-next"></span> </a> </li> <?php endwhile; endif; get_footer(); ?>
I also tried to put the code after the while loop.
Update I solved the problem. When I published my posts, they had all the same date, so it displayed only one post from this date. I changed with a different day date, and it works! My bad.