Add comments_per_page filter

git-svn-id: https://develop.svn.wordpress.org/trunk@7859 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2008-04-30 20:05:25 +00:00
parent 140217c822
commit 95e19665b0
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
));