Since version 2 of bbPress was released some users haven’t been happy with their options for a “Recent Replies” widget.   Shortcode below as written to provide flexibility.

Shortcode: [bbpress_recent_replies_by_topic].

It allows for a parameter to determine the number of replies shown (defaults to 5). That parameter is “show”, and is used in the shortcode like so: [bbpress_recent_replies_by_topic show=10]

The shortcode gathers the 5 most recent replied-to topics, and their most recent replies. Then, while looping through the replies, it calls the 2nd function to output a row of data. You should only edit the “custom_bbpress_recent_reply_row_template()” function to change the HTML.

About the Author

Jonathan Daggerhart

Long time Drupal and WordPress developer. I like to write modules and plugins, and I dabble in frontend and design.

12 thoughts on “bbPress Recent Replies Shortcode

  • Hamlet

    Awesome! Latest topic with reply and without reply !! [bbpress_recent_replies_by_topic include_empty_topics=1]. For me better is shortcode than plugin without shortcode. That is more usefull!

    Thanks and goodluck Daggerhart

  • Wokkels

    Is there any way of adding custom post types?
    All post types on my website has it’s own topic for replies instead of wp comments with bbPress Topics for Posts.
    The only downside is when one follows a recent reply link, they’ll get to the forum topic created by the bbPress Topics for Posts plugin, I’d rather have them end up on the page of a custom post type.

    A recent posts code was easy made but doesn’t serve the need.

  • Glados


    In what file can i write your code? I looking in bbpress.php etc via search and dont see a “custom_bbpress..” Thnak you for a reply.

    • Jonathan Daggerhart

      Hi Glados,

      You can put this code in your theme’s functions.php file, or in a custom plugin if you have one. You should edit any of the files that come with bbpress.

      • Glados

        When i copy this into function my website stop working.

        I try: i donwload in and copy a php file into child theme + /plugins/bbpress and trying to use a shortcode in text widget like that: [bbpress_recent_replies_by_topic] still no working. Any idea? ;) Thank you.

        • Jonathan Daggerhart

          First approach– If you copy it to your functions.php file, you need to remove the first line of this code: <?php

          Second approach– If you add this as a new file in your theme folder, you have to “include” the new file by adding some code like this to your functions.php: include_once get_stylesheet_directory()."/bbpress_recent_replies-shortcode.php";

          If you have trouble with either of those approaches, this might not be the right solution for you. Using this relies on some understanding of PHP.

          Hope this helps, sorry if it doesn’t work out,

      • Glados

        Still working thx, need some changes in my theme. Thanks for a reply ;)

  • Jeremy

    Brilliant and easy to understand code! You are awesome thank you sooooooo much!

  • Moni

    Hi This shortcode is working amazingly, what I want is need pagination at the end of page on first page only 10 replies will show and on next page 10 replies and so on and user will also search replies please reply

  • Christian Hallgren


    Great shortcode!
    Can you explain how “// allow for specific forum limit” works? I cannot get it to work.


    • Jonathan Daggerhart

      Hi Christian,

      It’s been a while since I tested this, but I believe you would set the forum’s post ID in the shortcode like this:

      [bbpress_recent_replies_by_topic show=10 forum=123]

Leave a Reply

Your email address will not be published. Required fields are marked *