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