Pass walker arguments to get_comment_link() so pagination works when wp_list_comments() is used outside the comment template.

props SergeyBiryukov.
fixes #27007.

Built from https://develop.svn.wordpress.org/trunk@27799


git-svn-id: http://core.svn.wordpress.org/trunk@27634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2014-03-28 02:38:14 +00:00
parent e1e09075d4
commit 502ac958e5
1 changed files with 4 additions and 6 deletions

View File

@ -588,10 +588,8 @@ function get_comment_link( $comment = null, $args = array() ) {
$comment = get_comment($comment); $comment = get_comment($comment);
// Backwards compat // Backwards compat
if ( !is_array($args) ) { if ( ! is_array( $args ) ) {
$page = $args; $args = array( 'page' => $args );
$args = array();
$args['page'] = $page;
} }
$defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' ); $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
@ -1780,7 +1778,7 @@ class Walker_Comment extends Walker {
<br /> <br />
<?php endif; ?> <?php endif; ?>
<div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"> <div class="comment-meta commentmetadata"><a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
<?php <?php
/* translators: 1: date, 2: time */ /* translators: 1: date, 2: time */
printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' ); printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() ); ?></a><?php edit_comment_link( __( '(Edit)' ), '&nbsp;&nbsp;', '' );
@ -1822,7 +1820,7 @@ class Walker_Comment extends Walker {
</div><!-- .comment-author --> </div><!-- .comment-author -->
<div class="comment-metadata"> <div class="comment-metadata">
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>"> <a href="<?php echo esc_url( get_comment_link( $comment->comment_ID, $args ) ); ?>">
<time datetime="<?php comment_time( 'c' ); ?>"> <time datetime="<?php comment_time( 'c' ); ?>">
<?php printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() ); ?> <?php printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() ); ?>
</time> </time>