Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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';
share|improve this answer
Awesome... thanks! That worked perfectly. –  mattrepublic Sep 30 '10 at 20:41
You are welcome! –  sorich87 Sep 30 '10 at 21:28

Your Answer


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.