Skip to content

Instantly share code, notes, and snippets.

@ahmednuaman
Created January 9, 2012 09:21
Show Gist options
  • Save ahmednuaman/1582149 to your computer and use it in GitHub Desktop.
Save ahmednuaman/1582149 to your computer and use it in GitHub Desktop.
Pagination for query_posts
$m = $wp_query->max_num_pages;
if ( $m > 1 )
{
?>
<div class="pagination">
<ul>
<?php for ( $i = 1; $i <= $m; $i++ ): ?>
<li>
<a href="<?php the_permalink(); ?>/page/<?php echo $i; ?>" title="Go to page <?php echo $i; ?>">
<span>
Page <?php echo $i; ?>
</span>
</a>
</li>
<?php endfor; ?>
</ul>
</div>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment