Question

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.

Was it helpful?

Solution

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';
}
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top