Add paging links above comments list. Props Viper007Bond. fixes #8219
git-svn-id: http://svn.automattic.com/wordpress/trunk@10097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e9e703969b
commit
9f56c8eba4
|
@ -20,9 +20,15 @@
|
||||||
<?php if ( have_comments() ) : ?>
|
<?php if ( have_comments() ) : ?>
|
||||||
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
|
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
|
||||||
|
|
||||||
|
<div class="navigation">
|
||||||
|
<div class="alignleft"><?php previous_comments_link() ?></div>
|
||||||
|
<div class="alignright"><?php next_comments_link() ?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ol class="commentlist">
|
<ol class="commentlist">
|
||||||
<?php wp_list_comments(); ?>
|
<?php wp_list_comments(); ?>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
<div class="alignleft"><?php previous_comments_link() ?></div>
|
<div class="alignleft"><?php previous_comments_link() ?></div>
|
||||||
<div class="alignright"><?php next_comments_link() ?></div>
|
<div class="alignright"><?php next_comments_link() ?></div>
|
||||||
|
|
|
@ -513,6 +513,9 @@ function &separate_comments(&$comments) {
|
||||||
function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
|
function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
|
||||||
global $wp_query;
|
global $wp_query;
|
||||||
|
|
||||||
|
if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) )
|
||||||
|
return $wp_query->max_num_comment_pages;
|
||||||
|
|
||||||
if ( !$comments || !is_array($comments) )
|
if ( !$comments || !is_array($comments) )
|
||||||
$comments = $wp_query->comments;
|
$comments = $wp_query->comments;
|
||||||
|
|
||||||
|
|
|
@ -1265,6 +1265,9 @@ function next_comments_link($label='', $max_page = 0) {
|
||||||
if ( empty($max_page) )
|
if ( empty($max_page) )
|
||||||
$max_page = $wp_query->max_num_comment_pages;
|
$max_page = $wp_query->max_num_comment_pages;
|
||||||
|
|
||||||
|
if ( empty($max_page) )
|
||||||
|
$max_page = get_comment_pages_count();
|
||||||
|
|
||||||
if ( $nextpage > $max_page )
|
if ( $nextpage > $max_page )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1324,7 +1327,7 @@ function paginate_comments_links($args = array()) {
|
||||||
$page = get_query_var('cpage');
|
$page = get_query_var('cpage');
|
||||||
if ( !$page )
|
if ( !$page )
|
||||||
$page = 1;
|
$page = 1;
|
||||||
$max_page = $wp_query->max_num_comment_pages;
|
$max_page = get_comment_pages_count();
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'base' => add_query_arg( 'cpage', '%#%' ),
|
'base' => add_query_arg( 'cpage', '%#%' ),
|
||||||
'format' => '',
|
'format' => '',
|
||||||
|
|
Loading…
Reference in New Issue