Forums

Comments: Reply to "get_comment_author" help :) (3 posts)

  1. unleashreality
    Member
    Posted 1 year ago #

    Hey everyone!!

    on the single page, in the comments section, where it says "reply" under each comment when threaded comments is on...

    i want to make it so that instead of just "reply", it says "reply to *name*" where *name* is the person to whom they are replying.

    <?php print get_comment_author(); ?>
    is giving me the comment author's name

    but the reply button has the following
    <?php comment_reply_link(array_merge( $args, array('reply_text' => __('Reply to %s','TheStyle'),'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

    and when i try to put the first bit of code in the 'Reply to' bit, i get an error. I'm new to php so not sure if i can put php in a php function?

    would really appreciate the help :)

  2. Reuben Gunday
    Member
    Posted 1 year ago #

    <?php
    $author_name = get_comment_author();
    comment_reply_link(array_merge( $args, array('reply_text' => __( sprintf('Reply to %s', $author_name),'TheStyle'),'depth' => $depth, 'max_depth' => $args['max_depth'])));
    ?>
  3. unleashreality
    Member
    Posted 1 year ago #

    Perfect :)

    thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic