In bbPress Comments are generally called Posts.
I think the Posts column is set up by default.
In the Latest Discussions table, look for this cell: <th><?php _e(‘Posts’); ?></th>, which is the title of the column, and this:<td class=”num”><?php topic_posts(); ?></td>, which is the content of the comuns, displaying the number of Posts (Comments).
One quick note: posts include the “first post”, i.e. the original topic. If you want to only show comments on that first post, you have to subtract one from the post count.
Thanks you guys.
johnhiler – How would I subtract one from the post count?
Something like this:
<div class=”commentcount”><?php $commentcount = $topic->topic_posts -1; echo ($commentcount) ?> <img alt=”number of comments” src=”/images/sticky-bubble.gif” /></div>
Is there a way I can work that into this: <?php topic_posts(); ?>
You’d replace the
topic_posts(); with the code that johnhiler wrote.
Is it worth running through that calculation for every listed post though? People on your forum would soon become familiar with Number of Posts rather than Replies to Post statistics.
13 years, 8 months ago
I’d like to show the number of comments that a topic has. How would I go about doing this?
Thanks in advance.