Pagination for WordPress posts!

Add pagination
Screenshot to show placement of the code

I’ve been digging around for a not-too-technical way to paginate single WP blog posts (ie: Next post ~ Previous post). Found it!

By adding the red line of code to the single.php file  just below the the “posts” line, I now have simple pagination above any single post on my blog. The single.php file is located in your theme directory. [Appearance / Themes / Editor]

The pagination only shows up when you are viewing a single post (single.php), which comes in handy if someone goes directly to a blog post via a search result or Tweet.

Here’s the code…

<p><?php previous_post('%', 'Previous:', 'no'); ?>
| <?php next_post('%', 'Next:', 'no'); ?></p>

fyi, the ‘no’ is saying do not show the title of the next or previous post. Change it to ‘yes’ to show the post titles and see if it works for you. Also, you can remove or change “|” to anything else you want to use as a separator.

fyi, I am using WordPress 3.3.1 / zeeBizzCard theme.

Let me know if you have any success with this.


Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *