Clicking Comment "Reply" Button only replies to first comment
I'm editing my comments.php, and within it I've added a reply button like this:
div class=reply
a rel=nofollow class=comment-reply-link
href=?php comment_reply_link(array('reply_text' = 'Reply this comment'), comment_ID()); ? data-commentid=3
data-postid=487 data-belowelement=div-comment-3 data-respondelement=respond
data-replyto=Reply to admin aria-label=Reply to admin Reply
/a
/div
When I click on the reply button under any comment, the comment form pops up beneath the first comment, and only replies to the first one, rather than the one I clicked on. Can anyone explain the errors in this code and describe how to fix it?
I also tried doing
div class=reply
?php comment_reply_link(); ?
/div
But the comment_reply_link()
returns null
, I believe.
I list the comments like so:
?php
if (have_comments()) : ?
ol class=post-comments
?php
wp_list_comments(array(
'style' = 'ol',
'short_ping' = true,
'callback' = 'better_comments'
));
?
/ol
?php
endif;
and have a function better_comments() {...}
which includes the above HTML for the reply div.
Here's the first bit of that function:
li class=comment byuser comment-author-admin bypostauthor even thread-even depth-1 id=comment-3 style=margin-bottom: 0.7em;
div id=div-comment-3 class=comment-body
div class=comment-author vcard
a class=comment-author-text
b?php echo ucwords(get_comment_author()) ?/b
/a
Thanks.
Topic comment-form comments Wordpress
Category Web