This tutorial will detail how to create a custom WordPress loop with pagination.

To implement this custom loop, I will use WP_Query class to setup a new query, and then display the posts with pagination. Now remember that the default WordPress pagination (as implemented by Next Page and Previous Page) is easy to implement and code. However, this setup does not go well with modern themes.

Custom Query

This tutorial is based on WP_Query, and thus I would recommend you read up relevant codex pages to understand how this class works.
A sample of the query being run is as follows:

Code to Render Pagination

Put the following code in a custom static page by creating a template file (with the name CusotmPage.php) in the theme folder.

Create a page in the admin area and select the template as shown below:

Pagination Function

The following code is required for the custom pagination to function. Put this code in functions.php ( located in the theme folder):

Styling for the Pagination

Open up the style.css (located in the theme folder) and add the following code:

Here is the output of the custom pagination code:

Get Blazing Fast WordPress Hosting With
$25 FREE CREDIT

Use Promo Code: WPB25

Conclusion

In this tutorial, I discussed how you could easily setup custom pagination for your WordPress website. The idea is implemented through WP_Query class. If need help with the code or have a question about this tutorial, feel free to comment below.