WordPress Pagination Without A Plugin

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:
[php] 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
) );

Now you can call the function:

View Source →



21 year old designer, blogger and front-end developer. love to share creative design and inspiration.


    • First you need to add function in to your theme functions.php and then you need to call the function at the bottom of index.php

    • Ok thanks. I’m not sure where the pagination is supposed to appear though… at the bottom of posts? Could you provide a screenshot? Thanks for replying to my question!

    • Go to your theme folder and find this line previous_posts_link and next_posts_link in index.php, archive.php, category.php, search.php and any other archive page template. and replace it with this: