Adding Previous or Next Post Links to your WordPress Blog
Some WordPress themes automatically include a “next post” or “previous post” entry at the end of each post which shows the reader the previous and next blog entries with a clickable link. This can be a good way to present your other articles recently published and if you like this feature, fear not, you can add it to your current WordPress blog theme very easily.
You will need to open your WordPress editor and edit your “Single Post Template” called “single.php”
Near the end of the file you may see the following lines (look for the lines that would display your tags or comments which typically are at the end of your post).
<?php the_tags( ‘<p>Tags: ‘, ‘, ‘, ‘</p>’); ?>
<?php edit_post_link(‘Edit this entry.’,”,”); ?>
<?php comments_template(); ?>
</div>
</div>
What you want to do is add the custom lines below after the ?php comments statement but before the final closing /div statement so it looks like this:
<?php the_tags( ‘<p>Tags: ‘, ‘, ‘, ‘</p>’); ?>
<?php edit_post_link(‘Edit this entry.’,”,”); ?>
<?php comments_template(); ?>
</div>
<div class=”navigation”>
Next post: <?php next_post_link(‘%link’); ?> <br> Previous Post: <?php previous_post_link(‘%link’); ?>
</div>
</div>
After you save your file go ahead and test an individual post on your blog and make sure you now see the navigation links at the bottom to the previous and next post. If the style of the text and links is not what you want, you can try to choose another class for the font format, or create your own in the stylesheet.css so you can have the fonts/link colors match what you are looking for.
(You can look at my individual posts to see how this looks in action)
-Dragon Blogger
Related posts:
- Creating A Sticky Post For Your WordPress Blog A sticky post can be an essential part of your blog if you use your blog as a company or...
- Adding Google Analytics to your WordPress Blog I have compiled a list of tips and helpful hints for anyone who needs to add Google Analytics code for...
- WordPress Tip: Adding Author Bio Box Inside Posts Add wordpress author bio box to articles to help show information about authors in Wordpress posts...
- Adding A BlogNetAward Widget To Your WordPress Blog My friends over at BlogNetAwards enjoyed my “How to vote” video demonstration and asked that I create another demonstration showing...
- How to Guest Post on a WordPress Blog Demonstration on how to create a guest post for a Wordpress blog, a Wordpress editor demo with how to set...
















[...] “Previous” and “Next” Post Links code for your WordPress blog. [...]