Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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"] 
));  
?>
share|improve this question

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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