WordPress custom pagination for Bootstrap

Wordpress custom pagination

Creating custom pagination in WordPress can be a pain and a time consuming task especially if you are creating a Bootstrap based theme. WordPress echoes pagination as <a> tags while Boostrap styled pagers and pagination use <ul> and <li> tags with predefined CSS classes assigned to these elements.

In this tutorial we will cover how to create custom pagination, you should probably learn more about paginate_links so you can understand the following code. Just add the function to your functions.php file:

The current page will have the “active” class so you can style it differently <li class=”active”>.

Now, let’s call the function wherever we want to display the pagination. Make sure you’re calling it outside the loop:

I hope you find this code snippet useful.


   One Comment


  1. Hamed

    Thanks for sharing !