I have comments and each comment can have any number of replies. After a comment, but before the replies, I want to output how many replies there are. I have thought of two alternative ways to do this:
-
(more involved in coding, but requires less knowledge of wordpress and the database)
Make an array with strings and another with ints. Each position of both arrays corresponds to a nesting level in the comment/reply structure. When outputting a comment check what nesting level, or “$depth” you’re on and “retire”, or output, the information stored in the arrays up and until the same nesting level. Then add information of the current nesting level and of course update the int that’s one nesting level above to count the current comment.
— Somewhat involved, my php skills or debugging tools are not great so this would take a couple of hours to do. -
(quick but must find some support/function in wordpress that gives me what I want)
Just find some function in wordpress that displays/returns the number of replies that a comment has (including nested comments)
I accomplished this same thing with a function
}
and the actual code to output it:
I think there is not an available function in wordpress which does this. so you will have to hack it yourself. like Imoda suggests, use Sql query which can be done with $wpdb. there is a similar question you may want to take a look. https://wordpress.stackexchange.com/questions/16457/count-parent-comments-replies-separately
There might be a plugin that does it:
http://wordpress.org/extend/plugins/gregs-show-total-conversations/