Add depth handling to comment_reply_link(). see #7635

git-svn-id: http://svn.automattic.com/wordpress/trunk@8878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-09-12 23:45:15 +00:00
parent dcf62be039
commit 8db1601dd7

View File

@ -845,10 +845,12 @@ function comment_reply_link($args = array(), $comment = null, $post = null) {
global $user_ID; global $user_ID;
$defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'), $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
'login_text' => __('Log in to Reply')); 'login_text' => __('Log in to Reply'), 'depth' => 0);
$args = wp_parse_args($args, $defaults); $args = wp_parse_args($args, $defaults);
if ( 0 == $args['depth'] || $args['max_depth'] < $args['depth'] )
extract($args, EXTR_SKIP); extract($args, EXTR_SKIP);
$comment = get_comment($comment); $comment = get_comment($comment);
@ -939,7 +941,7 @@ class Walker_Comment extends Walker {
<?php echo apply_filters('comment_text', get_comment_text()) ?> <?php echo apply_filters('comment_text', get_comment_text()) ?>
<div class='reply'> <div class='reply'>
<?php if ( 0 == $args['depth'] || $depth < $args['depth'] ) echo comment_reply_link(array('add_below' => 'div-comment')) ?> <?php echo comment_reply_link(array('add_below' => 'div-comment', 'depth' => $args['depth'], 'max_depth' => $depth)) ?>
<?php if ( 'list' == $args['style'] ) : ?> <?php if ( 'list' == $args['style'] ) : ?>
</div> </div>
<?php endif; ?> <?php endif; ?>