How to add pagination in wordpress

Sponsors

Many times adding the custom pagination in wordpress blog is very important. In this article I will show you how to add the simple pagination in wordpress.

You need to open the your index.php file from wordpress theme and put following code in that file.


<div class="navigation">
  <div class="alignleft"><? next_posts_link('&laquo; Previous') ?>
  </div>
  <div class="alignright"><? previous_posts_link('Next') ?>
  </div>
</div>

If you want the pagination in single post then you can use the following code:

<?php next_posts_link($label , $max_pages); ?>
<?php prev_posts_link($label , $max_pages); ?>

There are some very nice wordpress plugin available for wordpress pagination.
WP-PageNavi

PageNavi wordpress plugin is really nice. I personally like this plugin so much. With this plugin you can apply your custom css also.

Changing the CSS

If you need to configure the CSS style of WP-PageNavi, you can copy the pagenavi-css.css file from the plugin directory to your theme’s directory and make your modifications there. This way, you won’t lose your changes when you update the plugin.

Alternatively, you can uncheck the “Use pagenavi.css?” option from the settings page and add the styles to your theme’s style.css file directly.

Incoming search terms:

You may like following Articles!

5 thoughts on “How to add pagination in wordpress

  1. Pingback: How to add pagination in wordpress « digcms

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>