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

View File

@ -588,10 +588,8 @@ function get_comment_link( $comment = null, $args = array() ) {
$comment = get_comment($comment);
// Backwards compat
if ( !is_array($args) ) {
$page = $args;
$args = array();
$args['page'] = $page;
if ( ! is_array( $args ) ) {
$args = array( 'page' => $args );
}
$defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
@ -1780,7 +1778,7 @@ class Walker_Comment extends Walker {
<br />
<?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
/* 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;', '' );
@ -1822,7 +1820,7 @@ class Walker_Comment extends Walker {
</div><!-- .comment-author -->
<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' ); ?>">
<?php printf( _x( '%1$s at %2$s', '1: date, 2: time' ), get_comment_date(), get_comment_time() ); ?>
</time>