• Resolved Doodlebee

    (@doodlebee)


    Anyone know if there’s some method of testing to see if a comment has replies? I can easily grab the parent ID of comments, but I need to add a class to a comment if it has replies (children) to it. I can’t, for the life of me, figure out how to do so.

Viewing 3 replies - 1 through 3 (of 3 total)
  • looking into /wp-includes/comment-template.php (line 1348; part of the comment walker), there is this line:

    <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">

    the code empty( $args['has_children'] ) ? '' : 'parent' seems to work if used in the comment-callback function in twenty ten.

    it seems that a theme with standard wp_list_comments() would have the css class .parent automatically on the <li> tag of comments with replies (untested).

    Thread Starter Doodlebee

    (@doodlebee)

    Cool – I’ll give that a shot. (I’m using the “div” instead of “li”, so I don’t know if that makes a difference) – thank you so much!

    Thread Starter Doodlebee

    (@doodlebee)

    YES! You are a HERO. Thank you SO MUCH!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Testing comments for replies?’ is closed to new replies.