When viewing topics or replies, in the header, you can see the exact date and time when the topic or reply is published.

But, with some minor changes, you can show the time passed since the publish date instead. This is similar to freshness that bbPress shows in the topics and forums lists. To make this change, you need to modify the bbPress templates for displaying single topic and reply. It is not recommended to directly modify bbPress templates, instead, override the templates through your theme by following this tutorial.

The method displayed here affects topics and replies displayed on the single topic or single reply pages.

Lead Topic Template

  1. Override the ‘content-single-topic-lead.php‘ template.
  2. Find the line with the function call bbp_topic_post_date();
  3. Replace that function call with bbp_time_since(get_the_time(‘U’, bbp_get_topic_id()));

So, the line in the original template looks like:

<span class="bbp-topic-post-date"><?php bbp_topic_post_date(); ?></span>

And in the override file it should be:

<span class="bbp-topic-post-date"><?php bbp_time_since(get_the_time('U', bbp_get_topic_id())); ?></span>

Single Reply Template

  1. Override the ‘loop-single-reply.php‘ template.
  2. Find the line with the function call bbp_reply_post_date();
  3. Replace that function call with bbp_time_since(get_the_time(‘U’, bbp_get_reply_id()));

So, the line in the original template looks like:

<span class="bbp-reply-post-date"><?php bbp_reply_post_date(); ?></span>

And in the override file it should be:

<span class="bbp-reply-post-date"><?php bbp_time_since(get_the_time('U', bbp_get_reply_id())); ?></span>

Notice

By default, bbPress uses Reply template to show the lead topic in the single topic page. Lead Topic Template is used only when the lead topic is active.

Please, take a few seconds and rate this answer
No votes yet.
Please wait...

Question answered by

Milan Petrovic

Programmer since the age of 12 and now WordPress developer with more than 8 years of WordPress experience, author of more than 100 plugins and more than 20 themes.

WP Engine - Premium WordPress Hosting for your company customers

The Comments

Leave a Reply

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