Adding Previous or Next Post Links to your WordPress Blog
Posted by: dragonblogger // Category: bloggingSome 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 Author Bio Box Inside WordPress Post Found articles that help you not only add an author bio box into wordpress, but also to add a custom...
- 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...
- Add NoFollow To Your WordPress Archive and Category Links One of the ways to improve your Google PageRank is to limit the number of link juice you have flowing...
- Search and Add Amazon Affiliate Links Inside WordPress Posts Using the Amazon Reloaded plugin for Wordpress you can easily search for and add Amazon.com affiliate Images or links directly...
| via FaceBook, Twitter, RSS or Email | ![]() |
Enter your email and subscribe now!
Tags: adding next post on blog, adding previous post on blog, blogging post tips, blogging tips, customize blog theme, customize single.php, wordpress css tips, wordpress customization, wordpress php tricks, wordpress post entries, wordpress single.php, wordpress stylesheet, wordpress tips









December 19th, 2009 at 2:34 pm
I followed your directions for entering the text(which was the best I’ve found), but the links don’t show up on my site. I don’t know what else to do!
Andrea´s last blog ..You Don’t Know Where That’s Been!
[Reply]
December 19th, 2009 at 2:58 pm
Send me your single php file and I will look at it, my email is contactme [at] dragonblogger [dot] com
[Reply]
February 8th, 2010 at 10:58 am
A very clear tutorial. You have a couple  showing up in the post.
Rose´s last blog ..Why People use Twitter
[Reply]
February 13th, 2010 at 3:16 pm
[...] “Previous” and “Next” Post Links code for your WordPress blog. [...]
April 17th, 2010 at 10:43 am
Doesn’t work for me. I get an error message.
This is what my code is right now:
When I insert yours, I get an error. And I don’t know how to get the title of the article to show instead of “Next post” & “previous post”.
Enci´s last blog ..“Please accept the enclosed sponge and pan scraper as a thank you for your contribution”
[Reply]
April 17th, 2010 at 2:18 pm
The wordpress comment cut off the code you were trying to insert, email me your issue contactme [at] dragonblogger [dot] com and I will see if I can send you the lines that work. Send me your single.php file (rename to single.txt)
[Reply]
July 15th, 2010 at 9:36 pm
how do i move the previous and next post navigation on top of a post not in the bottom of a post?
johnny´s last blog ..Video 3
[Reply]
July 16th, 2010 at 7:27 am
Insert the same code under the TITLE sections of your post before the “content” portion
[Reply]
August 19th, 2010 at 8:10 am
how to use this on Swift theme?
Thanks
zoul´s last blog ..Salah guna dawai kokot
[Reply]
August 19th, 2010 at 8:38 am
I don’t know on each specific theme, but all themes let you edit the single.php file (unless they are encrypted)
[Reply]