How to display html in only the first level of WP comments?
سؤال
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.
المحلول
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';
}
لا تنتمي إلى wordpress.stackexchange