WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

Example
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
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

 
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.