When your blog posts exceed a few dozen entries, it’s time to rethink your navigation. One way to improve its usability is to add numeric pagination to your blog page.
Adding pagination to your website has a lot of clear benefits. It makes it easier for spiders to crawl deep into your site’s architecture and can drastically improve your page load times.
In this post, we’ll start off by discussing what pagination is and why you should use it. We’ll also show you how you can add both numeric and previous-next pagination to your WordPress website. Finally, we’ll wrap up with a section on some free plugins you can use to implement pagination if you’d rather not take the DIY approach.
Let’s get started.
What Do I Need to Know About Pagination?
Blogs and pagination go hand in hand. And that’s precisely why it’s no surprise that pagination is a core feature of the most popular content management system – WordPress.
According to the WordPress Codex, pagination is the process of splitting lists of posts or a single post into multiple pages for paged navigation.
Simply put, pagination allows you to display your blog posts in batches so that your site’s speed isn’t affected when you have hundreds of articles in your archives. Think of it this way: if you didn’t have pagination enabled, then all of your blog posts would have to be loaded every time someone accessed your blog page. For this reason, most themes have pagination enabled right out of the box.
Aside from page load times, pagination also helps increase your conversion rates. Unlike infinite scrolling, a paginated website prompts the user to make decisions and move forward by clicking. Finally, pagination improves your site’s usability by making your content easy to navigate through. If your visitors land on your site to accomplish a task (for instance, finding information), then usability trumps style.
Pagination can effectively be used in different kinds of scenarios. For instance, you can use it to split up lists of blog posts into multiple pages (like we do on this blog), break a particularly long post up into a few pages, or publish forum responses on different pages to improve readability. With this in mind, let’s take a look at how you can implement pagination on your WordPress website in a few easy steps.
How Do I Manually Add Pagination to WordPress?
Adding pagination functionality to your WordPress website is one of those things you can easily do without installing a plugin. In this section, we’ll show you how to add both numeric (1, 2, 3, …) and previous-next (Previous Page, Next Page) pagination to your website.
As always, we recommend that you create a full backup of your website before you begin.
Option 1: Page Number Pagination
Numeric pagination is used on all kinds of different websites (including Google search results). By default, however, WordPress themes come with Previous-Next links style pagination. And while this type of pagination is suitable for websites that have very little content to begin with or are simply breaking a single post up into two pages, sites that have large archives may want to opt for numeric pagination instead.
Numeric pagination allows your site’s viewership to zero in on a particular page instead of trudging through each page one at a time. If Previous-Next pagination is a cassette tape, then numeric pagination is a CD. Here’s how you can add numeric pagination to your WordPress website:
Start off by adding the following lines of code to your currently active theme’s functions.php file.
https://gist.github.com/rafaysansari/c954479777819712c598a756ea8e60ed
Next, add the following styling rules to the currently active theme’s style.css file.
https://gist.github.com/rafaysansari/3ac14a854770cfc41e32981a57e56df6
Finally, head over to your theme’s index.php file and add replace the existing pagination code with the following code snippet:
https://gist.github.com/rafaysansari/4d0178fae88d9bc7593cecbef880644a
Remember to save changes to each file after every update.
Option 2: Previous-Next Links Pagination
While most themes have Previous-Next links pagination built-in right out of the box, it’s entirely possible that yours doesn’t. If yours doesn’t and you’re leaning towards adding Previous-Next links pagination instead of numeric pagination, then here’s how you can get started:
First, add the following lines of code to your currently active theme’s functions.php file:
https://gist.github.com/rafaysansari/79c88c63c20cc0d11d5bebf30e53a27e
And to call the function, add this line of code to your index.php file in place of the existing pagination:
https://gist.github.com/rafaysansari/907411dda40ec5aab6ffae16a7c5a9bc
Which Plugins Can I Use for Pagination in WordPress?
If you’d rather not mess around with your theme’s core files, then you can always install a pagination plugin to help you out. Thankfully, the WordPress Plugin Directory has tons of free pagination plugins that are designed to make it easier for you to add pagination to your theme. One major benefit of using a plugin is that it gives you finer control over your pagination elements’ customization.
We’ve picked out three of the best pagination plugins for you to try. In this section, we’ll go over each one and highlight their standout features.
WP-PageNavi
With over one million active installs, WP-PageNavi is the most popular pagination plugin for WordPress websites. It allows users to replace the default Older Posts – Newer Posts links with numeric pagination. The only downside of using this plugin is that it requires you to make a few modifications to your theme’s files to call the function it generates.
Aside from those minor changes, the WP-PageNavi plugin does everything else for you. All you have to do is configure your preferred pagination settings and hit the Save button. You can choose to display the numeric pagination as a list or as a drop-down menu.
Key Features:
- Allows you to set the text that is displayed on the front-end for the Next and Previous links.
- Lets you decide where to display the pagination links on different pages.
- Choose to enable/disable pagination elements and labels.
- Allows you to change the class names that are pre-assigned to the navigation elements.
WP-Paginate
Max Foundry’s WP-Paginate offers a simple and intuitive solution for adding pagination to your WordPress theme. The plugin comes with built-in options for adding custom CSS to style the pagination links on the front-end. WP-Paginate’s settings page allows you to configure the pagination labels, locations and positions, and the pagination links’ appearance. In addition to this, WP-Paginate comes with three different numeric pagination styles right out of the box.
WP-Paginate also allows you to paginate post comments, which is especially useful for websites that receive tons of comments on each post on average. This not only improves readability but is good for your site’s SEO ranking.
Key Features:
- Comes with three different numeric pagination link styles right out of the box.
- Allows you to customize the pagination links’ location, position, and appearance.
- Offers pagination functionality for post comments.
- Doesn’t require you to modify your theme’s files or mess around with code.
Pagination by BestWebSoft
BestWebSoft’s Pagination plugin is a lightweight plugin that allows you to add custom pagination to just about any page on your WordPress website. Once you have the plugin installed and activated, all you have to do is select a pagination type, position it, and customize its appearance.
The Pagination plugin also lets you add pagination functionality to your theme’s comments section. What’s more is that the plugin offers tons of customization options to style your pagination links. You can choose to display the next-previous arrows, Page X of Y style labels, full or short numeric links, and configure which pages to hide pagination on.
Key Features:
- Fully customizable.
- Allows you to add pagination to comments.
- Lets you decide which pages to hide pagination links on.
- Tons of advanced displays (such as arrows and Page X of Y) to pick from.
Conclusion
Pagination gives your content a beginning and an end. Having an idea of direction is important especially when you’re trying to help your viewership accomplish their goal-oriented pursuits.
- If you have a large archive of blog posts, then numeric pagination would significantly improve your site’s user experience.
- Those of you who publish only a few articles daily might consider opting for Previous-Next links pagination instead.
- However, if it’s important for your visitors to know how many pages they can expect to find, then numeric pagination is the way to go.
- And if you’re thinking about splitting those large blog posts up into multiple pages, then Previous-Next links pagination would definitely look best.
Between numeric and previous-next pagination, which one do you prefer and why? Let us know by commenting below!