SearchForecast Marketplace

Adding Previous or Next Post Links to your WordPress Blog

Posted by: dragonblogger  //  Category: blogging

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:

  1. 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...
  2. 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...
  3. 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...
  4. 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...
  5. 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...


If you enjoyed this post, subscribe to DragonBlogger.com
via FaceBook, Twitter, RSS or Email
or
Enter your email and subscribe now!
Email:

Written by dragonblogger (1110 Articles Published)

Working in the IT Industry for over 10 years and specializing in web based technologies. Dragon Blogger has unique insights and opinions to how the internet and web technology works. An Avid movie fan, video game fan and fan of trying anything and everything new.

Follow dragonblogger on Twitter @dragonblogger

Tags: , , , , , , , , , , , ,

10 Responses to “Adding Previous or Next Post Links to your WordPress Blog”

  1. Andrea (2 comments) Says:

    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! My ComLuv Profile

    [Reply]

    dragonblogger (1957 comments) Reply:

    Send me your single php file and I will look at it, my email is contactme [at] dragonblogger [dot] com

    [Reply]

  2. Rose (16 comments) Says:

    A very clear tutorial. You have a couple  showing up in the post.
    Rose´s last blog ..Why People use Twitter My ComLuv Profile

    [Reply]

  3. 28 Blogging Resources for Beginning Bloggers | iWoodpecker Says:

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

  4. Enci (1 comments) Says:

    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” My ComLuv Profile

    [Reply]

    dragonblogger (1957 comments) Reply:

    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]

  5. johnny (1 comments) Says:

    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 3My ComLuv Profile

    [Reply]

    dragonblogger (1957 comments) Reply:

    Insert the same code under the TITLE sections of your post before the “content” portion

    [Reply]

  6. zoul (1 comments) Says:

    how to use this on Swift theme?

    Thanks
    zoul´s last blog ..Salah guna dawai kokotMy ComLuv Profile

    [Reply]

    dragonblogger (1957 comments) Reply:

    I don’t know on each specific theme, but all themes let you edit the single.php file (unless they are encrypted)

    [Reply]

Leave a Reply

CommentLuv Enabled

This site uses KeywordLuv. Enter YourName@YourKeywords in the Name field to take advantage.

Comments links could be nofollow free.