WPLift is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission.

Quick Tip: How to Add Numbered Pagination to WordPress

Last Updated on September 15th, 2021

Published on July 12th, 2014

Share This Article

For navigating older posts, by default WordPress uses next and previous links which are ok but only allow you to go back one page at a time. If you would like to know how to add numbered pagination to WordPress like we use here on WPLift you can do so using the paginate_links function.

How to Add Numbered Pagination to WordPress

This is really easy to do and will improve the look of your theme while making it more user friendly, so lets see how to use it.

Add this code to your theme’s functions.php file :

// Numbered Pagination
function wplift_pagination() {
	global $wp_query;
		$big = 999999999; // need an unlikely integer
			echo paginate_links( array(
			'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
			'format' => '?paged=%#%',
			'current' => max( 1, get_query_var('paged') ),
			'total' => $wp_query->max_num_pages
		) );

Then where you want the pagination to appear, for example on archives.php, index.php etc you place this code :

<?php wplift_pagination(); ?>

Now you need to style the resulting code, here is what I use in my Blogly theme, you need to add this to style.css in your theme folder:

/* Pagination */
.page_nav .page-numbers{
	margin: 4px 4px 4px 0;
	padding:15px 18px 14px 18px;

.page_nav .page-numbers:hover{
	background: #24221D;
	text-decoration: none;

.page_nav .current{
        background: #24221D;
        padding:15px 18px 14px 18px;

Stay informed on WordPress

Every Friday you’ll receive news, tutorials, reviews, and great deals from the WordPress space.

Invalid email address
A team of WordPress experts that love to test out new WordPress related software, WordPress plugins and WordPress themes.