WordPress Pagination | How to paginate in WordPress

This article is the basic introduction to how to paginate in WordPress. It will show you how to do WordPress pagination.

WordPress basic pagination

In your theme, find your index.php file (/wp-content/themes/YOURTHEME/index.php). Add in the following code wherever your want your pagination outside the loop.

<?php if (  $wp_query->max_num_pages > 1 ) : ?>
<?php next_posts_link( __( '&larr; Older posts', 'twentyten' ) ); ?>
<?php previous_posts_link( __( 'Newer posts &rarr;', 'twentyten' ) ); ?>
<?php endif; ?>

This will give you the good old:

<– Older posts
Newer post –>


I personally dont like this and use instead:

WordPress WP-PageNavi

The final result is a navigation like this one:


Follow two simple steps to get this beautiful WordPress pagination:

Step 1

Iinstall plugin WP-PageNavi.

Step 2

Replace code above with:

<?php if (  $wp_query->max_num_pages > 1 ) : ?>
<?php wp_pagenavi(); ?>
<?php endif; ?>

This is it. Enjoy your beautiful pagination!

The perfect season to resolution health problem is before any visible sign appears. Actually there isn’t anything you can’t purchase on the Internet anymore. Whereas erectile dysfunction is more common among older men, that doesn’t something you just have to live with. What about “canadian pharmacy cialis 5 mg” and “cialis canadian pharmacy“? In our generation, there are divers options for those ones who suffer from erectile malfunction. You may have heard about “canadian pharmacy online cialis“. More info about the matter available at “canadian pharmacy cialis 20mg“. Why it happen? Can sexual disorders in men be prevented? If you get any prescription remedies like Viagra, check with a dispenser that they are sure to take with your other remedies.