#8204 closed defect (bug) (invalid)
get_comment_reply_link not working in callback
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.7 |
| Component: | Comments | Keywords: | callback, comments, get_comment_reply_link |
| Focuses: | Cc: |
Description
The get_comment_reply_link function doesn't work when using a callback to customize the output of wp_list_comments This is a sample of the code I'm using.
function custom_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID( ); ?>">
<div class="avatar_cont"><?php echo get_avatar( get_comment_author_email(), '50' ); ?></div>
Comment by <em><?php comment_author_link() ?></em>:
<?php if ($comment->comment_approved == '0') : ?>
<em>Your comment is awaiting moderation.</em>
<?php endif; ?>
<br />
<small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('l, F jS Y') ?>
at <?php comment_time() ?></a> | <?php edit_comment_link('Edit','',''); ?></small>
<?php comment_text() ?>
<div class="reply">
<?php echo get_comment_reply_link(); ?>
</div>
<?php
}
Most of this was taken from this example by Ryan here.
Change History (6)
#2
@
18 years ago
I should have mentioned that it doesn't work with this code either.
<?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['depth'])) ?>
I think that defaulting to always showing would be a good idea.
#3
@
18 years ago
Okay I think I figured out the problem. It looks like the $args['depth'] isn't working. If I manually set the max_depth then the link shows up. So if I use code like this then it works.
<?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => 5)); ?>
Note: See
TracTickets for help on using
tickets.
I think you have to pass depth for it to do anything. Maybe we should default to always showing the link if no depth is passed.