Its pretty easy to add a loop to a page template but having pagination will provide some roadblocks if you’re trying to use the standard previous and next template tags. The solution I came up with this afternoon is pretty basic and if there’s a better alternative I’m open to hear them.
Place this after get_header() within your page template.
$paged = (get_query_var('paged')) ? (int) get_query_var('paged') : 1;
$page_link = get_permalink($id);
Not sure what type of loop you want to create but here’s what I recently used under the page content.
<?php
$events_query = new WP_Query('category_name=Custom&paged='.$paged);
while ($events_query->have_posts()) : $events_query->the_post();
// post markup would go here, e.g. the_excerpt();
endwhile;
?>
I also wrapped my page content so it only showed on the first page and not the paginated pages.
<?php
if($paged == 1){
// all the page content markup, e.g. the_content();
}
?>
After those updates you’ll have a page template that returns a loop of posts under the “Custom” category.
The last step is adding the pagination links. Here’s the markup I used.
<div class="pagination"> <span class="previous"> <a href="<?php echo $link ?>page/<?php echo $paged + 1; ?>">&laquo; Previous</a> </span> <?php if($paged != 1): ?> <span class="next"> <a href="<?php echo $link ?>page/<?php echo $paged - 1; ?>">Next &raquo;</a> </span> <?php endif; ?> </div>
So, is there a better way out there? I hope so, since the previous and next links show regardless if there’s posts or not, and I don’t feel like writing those queries for this tutorial :).

I think I have a quick solution to at least hide the previous link if there aren't any more posts.
<?php if (count($subposts->posts) == get_option('posts_per_page')): ?>
<a href=”<?php echo $page_link ?>page/<?php echo $paged + 1; ?>”>Previous
<?php endif ?>
If you compare the posts returned to the posts_per_page you will know if you are at the end!
It's not perfect, but it's quicky + dirty
It's probably better to grab the found_posts from the query. Here's something that I'm starting use at http://sproutventure.com/portfolio
$posts_per_page = intval(get_query_var('posts_per_page'));$pages = intval(ceil($wp_query->found_posts / $posts_per_page)); if ( $paged < $pages ) :It's probably better to grab the found_posts from the query. Here's something that I'm starting use at http://sproutventure.com/portfolio
$posts_per_page = intval(get_query_var('posts_per_page'));$pages = intval(ceil($wp_query->found_posts / $posts_per_page)); if ( $paged < $pages ) :Thank You. Your idea is great. I am very grateful to you.