I want to show the 3 most recent comments and have a small div underneath that shows how many replies each comment has (count how many comments where comment_parent => comment_ID).
I do this by looping through each parent comment (comment_parent => 0) and then for each parent comment, use get_comments(comment_parent => $comment_ID).
Unfortunately the comment_parent is ignored on the inner-loop of each comment and I get returned an array of comments where comment_parent => 0. Why is comment_parent getting ignored?
<!-- DISPLAY RECENT COMMENTS -->
<?php $args = array(
'number' => 3,
'status' => 'approve',
'comment_parent' => 0
);
$recent_comments = get_comments($args);
foreach($recent_comments as $recent_comment){
echo '<div class="front-page-comments">';
echo $recent_comment->comment_content;
echo '</div>';
$parent_comment_id = $recent_comment->comment_ID;
$comment_meta_args = array(
'status' => 'approve',
'comment_parent' => intval($parent_comment_id),
'number' => 3
);
$replies = get_comments($comment_meta_args);
echo '<div class="front-page-comment-meta">';
echo $parent_comment_id . '<br />';
echo '<pre>';
print_r($replies);
echo '</pre>';
//echo $replies . 'Replies';
echo '</div>';
}
?>