WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Template Tags/paginate comments links

This article has been requested to be merged into Function Reference/paginate_comments_links.

Description

Generate a new way to list the paged comments in the comment template. Instead of using Previous or Next Comments links, it displays a full list of comment pages using numeric indexes.

This is probably the most efficient way to paginate comments in WordPress 2.7 since it allows the users to select wich comment page wants to visit instead of clicking trough every single page using the next/prev links.

Example:

 1 2 3 ... 10 Next >> 

Usage

 <?php paginate_comments_links(); ?> 

Parameters

Needs Further Completion

'base' => add_query_arg( 'cpage', '%#%' ),
'format' => ,
'total' => $max_page,
'current' => $page,
'echo' => true,
'add_fragment' => '#comments'

See Function_Reference/paginate_comments_links for further information and some usage examples.

Styling

The function prints several css classes for further CSS styling:

.page-numbers 
.current
.next
.prev

Example Source Code

<span class='page-numbers current'>1</span>
 <a class='page-numbers' href='http://www.site.com/post-slug/comment-page-2/#comments'>2</a>
 <a class='next page-numbers' href='http://www.site.com/post-slug/comment-page-2/#comments'>Next »</a>

Working Example

http://www.lagzero.net/2008/12/descarga-el-parche-de-gta-iv-para-pc-gta-iv-pc-v1010/#comments

Uses in the Default Theme

The following code uses this function to create the Comments Pages index in the Default Theme's comments.php:

 <div class="navigation">
  <?php paginate_comments_links(); ?> 
 </div>
 
 <ol class="commentlist">
  <?php wp_list_comments(); ?>
 </ol>
 
 <div class="navigation">
  <?php paginate_comments_links(); ?> 
 </div>
 

Changelog

Since: 2.7.0

Related

Comments Functions

See also index of Function Reference and index of Template Tags.