WordPress Pagination is a basic need for every websites using WordPress platform. There are many pagination plugin available. In this snippet I’m going to show you How to show WordPress Pagination without a Plugin.

Add the following to functions.php in your theme directory:

if ( ! function_exists( 'my_pagination' ) ) :
	function my_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
		) );
	}
endif;

Now you can call the function:

<?php my_pagination(); ?>

View Source →