Add comments_per_page filter

git-svn-id: http://svn.automattic.com/wordpress/trunk@7859 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-04-30 20:05:25 +00:00
parent 7750cc0d90
commit 0f13be9815
1 changed files with 7 additions and 5 deletions

View File

@ -131,22 +131,24 @@ unset($status_links);
<?php
$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
if ( isset( $_GET['apage'] ) )
$page = abs( (int) $_GET['apage'] );
else
$page = 1;
$start = $offset = ( $page - 1 ) * 20;
$start = $offset = ( $page - 1 ) * $comments_per_page;
list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
$comments = array_slice($_comments, 0, 20);
$extra_comments = array_slice($_comments, 20);
$comments = array_slice($_comments, 0, $comments_per_page);
$extra_comments = array_slice($_comments, $comments_per_page);
$page_links = paginate_links( array(
'base' => add_query_arg( 'apage', '%#%' ),
'format' => '',
'total' => ceil($total / 20),
'total' => ceil($total / $comments_per_page),
'current' => $page
));