Integrate pagination in wordpress themes

If we have a lot of post on our wordpress themes, pagination become important think. Its useful for navigation and better user experience. To implement pagination on wordpress themes, use the template tags bellow

<?php next_posts_link(‘Label’, ‘Max number of pages (default 0)’); ?>
<?php next_posts_link(‘Label’, ‘Max number of pages (default 0)’); ?>

Example usage

Copy piece of code bellow between content elemen, under post looping.

<div id="content">
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<div class="post">
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span class="postDate"><?php the_date('F j, Y'); ?> in <?php the_category(', ') ?> by <?php the_author() ?></span>
<div class="entry">
<?php the_content('more'); ?>
</div>
<?php comments_template(); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('Previous entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next entries') ?></div>
</div>
</div>

Incoming search terms for the article:

Related Posts

Simple Chat Plugin

EWWW Image Optimizer

Twitter Cards PHP 1.1

Create An Effective RSS Feed With mPress WordPress Plugin