Menu Close

Show “Last Post” and “Next Post” Links On Single WordPress Posts

default

Earlier today a buddy  of mine from Publishers Vault was asking me how to change his next and previous post links on his posts from the title of the post to a custom text such as “Previous Article and “Next Article”. I think most themes out there show the title for prev/next posts for SEO reasons but sometimes when titles get too long it can look pretty bad.

Below is a small code snippet that you can paste anywhere on your single.php files to show links to the post before and the post after the current post.

Next & Last Post Links Code With Custom Text

<?php
//last post
previous_post_link('%link', 'Last Post', TRUE); ?>
<?php
//next post
next_post_link('%link', 'Next Post', TRUE); ?>


View Source
Posted in WordPress