I insert the name of parent comment's author in child comment
if( $comment->comment_parent )
comment_author( $comment->comment_parent );
How to insert a comma to this construction in function.php?
Example,
if( $comment->comment_parent )
comment_author( $comment->comment_parent ) . ', ';
do not work.
Thanks
I insert the name of parent comment's author in child comment
if( $comment->comment_parent )
comment_author( $comment->comment_parent );
How to insert a comma to this construction in function.php?
Example,
if( $comment->comment_parent )
comment_author( $comment->comment_parent ) . ', ';
do not work.
Thanks
comment_author
prints the author. It doesn’t return anything.
So if you do this:
if ( $comment->comment_parent )
comment_author( $comment->comment_parent ) . ', ';
Then, what it really does is:
comment_author
(which is empty) and concatenate it with string containing ', 'And what you want is this:
if ( $comment->comment_parent ) {
comment_author( $comment->comment_parent );
echo ', ';
}