How would I display html code in only the first level of threaded comments?

L1 Comment
----L2 Comment
--------L3 Comment
L1 Comment

I have a piece of html code that contains basically reads "Reply to (author name) or post a new comment" and only need it displayed on L1 comments.

1 Answer 1


You can do this in the comments loop:

if( empty( $comment->comment_parent ) ) { //if the comment does not have a parent, then it is L1
    echo 'my-custom-html';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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