0

In functions.php for part of custom comments, I have the following echoed array as the link to respond to a previous comment:

<?php echo comment_reply_link(array(
"before" => " <span class=\"comment-reply-link\">", 
"after" => "</span>", 
"reply_text" => "Reply to this comment", 
"depth" => $depth, 
"max_depth" => $args["max_depth"] 
));  
?>

I am trying to get the link to replace the word "this" with the comment_author().

I am a novice at php, and have tried every syntax I can think of but have failed. I would appreciate if someone can help me with this.

To be clear, I'm looking for a way to make the following work.

<?php echo comment_reply_link(array(
"before" => " <span class=\"comment-reply-link\">", 
"after" => "</span>", 
"reply_text" => "Reply to " . echo comment_author() here . "'s comment", 
"depth" => $depth, 
"max_depth" => $args["max_depth"] 
));  
?>
1

I finally figured it out.

I was trying to call the wrong wp function.

By using get_comment_author() instead of comment_author() the link displays as desired.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.