Add next/previous entry to the top of the post
-
I think I’ve found where the template gets the next/previous post links for a single post. In the main index, there’s this code:
<?php locate_template( array( 'template-parts/loop-nav.php' ), true ); // Loads the template-parts/loop-nav.php template. ?>
This places “? Previous Post:” at the bottom, under the comment section. I’d like to move this to just below the post, before the comment section. I’d also like it to repeat at the top of the post so that I don’t have to scroll all the way to the bottom to click next or previous when it’s a long post.
I thought I could paste the text above before
<?php the_post(); // Loads the post data. ?>
and then again just before<?php comments_template( '', true ); // Loads the comments.php template. ?>
However, the next/previous post link is processed only once. The links are produced at the top-most location and then do not appear in the rest of the locations where I’ve included that code.Is there a different method to make these links appear anywhere on the page I want them?
- The topic ‘Add next/previous entry to the top of the post’ is closed to new replies.