Word Cracker의 잡다한 정보 모음

An alternative to the “bbPress New Topics” plugin


As you know, there is a plugin named “bbPress New Topics.” However, it seems it does not work with the latest version of WordPress. I installed it and tried to make it worked, but in vain.
I decided to make this feature for myself. I implemented it by comparing two dates: the current date and the topic date. If the date difference is less than 3 days for example, the label “New” is added.
New Label on bbpress

You can test it on this forum.

To add this feature, you need to add a few lines of codes to loop-single-topic.php (of the bbPress plugin) and functions.php (of your theme):

Please add the following function to your theme function file:

function mycustom_new_label_bbp($now, $last_active) {
$now = new DateTime($new);
$last_active = new dateTime($last_active);
$interval = $last_active->diff($now);
$difference = $interval->format('%R%a days');
if($difference < 3) {
echo "<span class='mycustom_new_label'>";
echo "New";
echo '</span>';


Please add the following php code to the file “loop-single-topic.php” just before the post tile code (for example, “<?php do_action( ‘bbp_theme_before_topic_title’ ); ?>”.)

<!-- For outputting "New" label -->
<?php $now = date("Y-m-d");
if ( !empty( $reply_id ) ) {
$last_active = get_post_field( 'post_date', $reply_id );
else {
$last_active = get_post_field( 'post_date', $topic_id );
<?php mycustom_new_label_bbp($now, $last_active); ?>

Lastly, you need to adjust the appearance of the button using CSS code. Please add the following CSS code to your stylesheet file:

/* For displaying "New" Label for topics less than 3 days */
.mycustom_new_label {
	display: inline;
	padding: .2em .6em .3em;
	font-size: 11px;
	line-height: 1;
	color: #ffffff;
	background-color: #d9534f;
	text-align: center;
	white-space: nowrap;
	vertical-align: baseline;
	border-radius: .25em;

Is there any way to make it as a plugin? I will try to search Internet to find out how to make WordPress plugins when I am free…

Related Posts

  1. wordcracker says

    Thank you very much for visiting my blog. If you want to display the number of replies instead of that of posts in bbPress, please refer to http://www.thewordcracker.com/advanced-wordpress/how-to-modify-the-number-of-replies-in-bbpress/

  2. virre131 says

    Hello wordcracker!
    Thank you for this code!! I found it really useful.

    Can I make this code also show the “new” label on forms that have topics with new content? I really miss this function.
    I would love this kind of function in my forum!

    1. wordcracker says


      Thanks for your comment.

      I think it will be possible to show the “new” label on forums that have topices with new content.

      Please add the following code to the file “loop-single-forum.php” (not “loop-single-topic.php”):

      < ?php $now = date("Y-m-d"); $last_active = get_post_meta( $forum_id, '_bbp_last_active_time', true ); if ( empty( $last_active ) ) { $reply_id = bbp_get_forum_last_reply_id( $forum_id );if ( !empty( $reply_id ) ) { $last_active = get_post_field( 'post_date', $reply_id ); } else { $topic_id = bbp_get_forum_last_topic_id( $forum_id );if ( !empty( $topic_id ) ) { $last_active = bbp_get_topic_last_active_time( $topic_id ); } } }?>
      < ?php mycustom_new_label_bbp($now, $last_active); ?>

      You can add the above code in front of “bbp_forum_title();”.
      I tested it and it works fine in my environment. I hope this will also work well in your system.

      1. virre131 says

        Thank you for the quick answer! I have one more question, when does the “new” label disappear from topics?

      2. wordcracker says

        It will be displayed for 3 days (I did not count it, but it’s expected to do so.)
        If you want, you can change the number from the function:

        if($difference < 3)

        (For example, if you change the number to “2”, it will be displayed for 2 days.)

  3. Nikhil P Naik says

    Hello, Thanks for this great plugin. I wanted a small change to this. if a user replies to a topic, then this symbol should disappear. can you help me with this?

    1. wordcracker says

      Hi Nikhil

      Thanks for your comment. I think it’s easy to implement it.
      I just tested and the following function works well:


      Please note that this function will return the number of replies + 1. (For example, if the actual number of replies is 2, bbp_get_topic_reply_count() will return 3.) Please consider this when creating a conditional php tag using this function.
      Please feel free to contact me anytime if you have any questions.

      1. Nikhil P Naik says

        I’ll try it out. Thanks a lot!

  4. Raj says

    where i can find “loop-single-topic.php” file?


    1. wordcracker says

      Hi raj

      Thanks for your comment.

      The “loop-single-topic.php” file can be found under:

      You can copy all files (or files you will modify) under the folder “…/wp-content/plugins/bbpress/templates/default/bbpress” to “…/wp-content/themes/your_theme_name/bbpress” and copy the css files under “…/wp-content/plugins/bbpress/templates/default/css” to “…/wp-content/themes/your_theme_name/css”. Then, the modified template files will not be affected even if bbpress is upgraded.

Leave A Reply

Your email address will not be published.