WordPress Pagination

Adding pagination to wordpress

The default previous/next navigation feature for WordPress posts and pages works well in some cases. However, it isn’t the most intuitive method. This is especially true for websites with a lot of published content.

Pagination – a function that splits content into separate pages – is one option that enables you to refine your website’s design and improve the way visitors navigate your content. This technique has both practical and aesthetic appeal, and it has become increasingly popular across the web.

In this post, we’ll introduce pagination and discuss various ways to add it to WordPress. This can be done using plugins, Ajax, or custom settings. Let’s get started!

Adding Pagination to WordPress

If you want to add pagination to your WordPress website, you’ll come across two major methods. The first is to use a plugin, and the second is through Ajax. We’ll explain both of these approaches in-depth soon, and introduce a few custom tweaks you can make as well. Before that, let’s consider the primary way pagination can be used in WordPress.

Blog Pagination in WordPress

Pagination is most commonly used in the blog sections of WordPress websites. It can be applied to individual posts, or used as a way to consolidate blog category pages:

blog pagination in wordpress

Blog pagination offers numerous benefits, both to your website and its visitors. For example, pagination can increase your search engine rankings. This is because there will be an increased number of links (i.e. more pages) pointing to your website.

For your visitors, pagination makes navigation simpler. Instead of using the default previous/next navigation method for posts and pages, pagination enables readers to click on specific page numbers. This means they’ll spend less time searching for posts and pages, and more time interacting with your content.

Pagination Plugins

The easiest way to use pagination in WordPress is with pagination plugins. A number of options exist, but let’s look closely at some of the top solutions.

First up is WP-Paginate. This plugin enables you to add numbered buttons just about anywhere on your site, including the Blog Page, Search Page, and Home Page. This helps improve your users’ experience (by enabling them to skip ahead to the desired page), and enhances the appearance of your website:

wordpress pagination plugin

Additionally, WP-Paginate enables you to customize the page buttons and even specific values (such as Page Range and Page Gap). This means you have control over the major elements of pagination.

Second, let’s take a quick look at WP-PageNavi. Similar to WP-Paginate, this plugin lets you add page numbers just about anywhere on your WordPress site. Unlike the previous plugin, however, it does require a bit of configuration:

wordpress plugin for pagination

Both WordPress pagination plugins enable you to switch from the default previous/next navigation to a more advanced, numbered system. They also let you add your own custom CSS if you’d like. However, there is another way to achieve the same end.

Ajax Pagination in WordPress

Asynchronous JavaScript And XML (AJAX) is a set of programming techniques that enables developers to create asynchronous web applications. In short, Ajax sends and retrieves information from a server without interfering with the page’s appearance, because it runs in the background. Ajax is used to change dynamic page content without reloading the entire page. This is commonly seen with infinite scroll, but also applies to pagination.

Using Ajax pagination, a website can frequently update with new content (such as blog posts) without interrupting the user’s experience. Your readers can see all the latest content you post while they’re on the page, but it won’t reload each time. Additionally, when users click onto the next page, they don’t have to wait for it to completely reload.

Ajax Pagination Without Plugins

We introduced a few plugin options above that enable you to add pagination to your WordPress website. However, Ajax pagination can be done without using a plugin.

It’s important to understand that this process requires quite a bit of coding. This means you should seriously consider creating a child theme first. That way, you’ll be able to make changes to your current website theme without interfering with its default code. This reduces the chance that you’ll make any critical mistakes, and makes it very easy to add your own code to the theme files.

Once your child theme is set up, there are three main steps to adding pagination to your site. Here is an overview of the process:

  1. Create an event. This is where you decide which action on your website (such as clicking a page number) will trigger the JavaScript part of the process.
  2. Create an Ajax call. Once JavaScript is ‘activated’, a request for data will be sent to the web server.
  3. Communicate with WordPress. Finally, the server’s response will determine how WordPress functions. In this case, it will call up a new page of content without reloading the entire page.

It’s easy to see how Ajax can improve pagination. All of these steps take place in a matter of seconds, which improves your site’s user experience immensely.

Custom Pagination

If you’d rather not use Ajax, you may be wondering if there are other ways to build custom pagination for your WordPress website. While plugins offer a few useful features, you can also alter your site’s pagination functionality yourself.

For example, you can modify the number of posts that will appear per page. While WordPress sets the default to 10, you can change that to almost any number you’d like. To do so, go to Settings > Reading > Blog pages show at most. Here, you can increase or decrease the value directly:

custom wordpress pagination

Another custom pagination feature that many users aren’t aware of is the ability to split a single post into multiple pages. This is great for list articles, or other types of long-form content. To implement this feature, all you need to do is add <!–nextpage–> (while in Text Editor) between the content you’d like to split:

wordpress blog pagination

If you’re a more advanced user, you can also experiment with CSS (within the styles.css file) to further customize your pagination. You can change elements such as backgrounds and font colors, padding elements, and hover effects. With a little work, you can set up your site’s pagination however you’d like!

Would you like to learn about more interesting elements you can add to your website? Follow WP Engine, and you’ll find plenty of articles on WordPress news and up-and-coming features. To get even more from WP Engine, you can also check out our managed hosting plans, which provides dedicated support and practically everything you need to run an effective website!

Get started.

Build faster, protect your brand, and grow your business with a WordPress platform built to power remarkable online experiences.

Chat with us!