Skip to:
Content
Pages
Categories
Search
Top
Bottom

show number of comments?


  • blah
    Member

    @crackpixels

    I’d like to show the number of comments that a topic has. How would I go about doing this?

    Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)

  • bb-gian
    Member

    @bb-gian

    crackpixels,

    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).


    johnhiler
    Member

    @johnhiler

    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.


    blah
    Member

    @crackpixels

    Thanks you guys.

    johnhiler – How would I subtract one from the post count?


    johnhiler
    Member

    @johnhiler

    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>


    blah
    Member

    @crackpixels

    Is there a way I can work that into this: <?php topic_posts(); ?>


    Tom(dB)
    Participant

    @tomdebruin

    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.

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.