This short code will show the current topic info of the bbpress forum plugin on the sidebar. You can place this code on your theme functions.php file.
/**
* bbpress topic info short code
*/
function bbpress_topic_info_func( $atts ){
global $wp_query;
$post = $wp_query->get_queried_object();
if($post->post_type == "topic"){
ob_start();
?>
<ul class="topic-info">
<li class="topic-forum">
In:<?php echo get_the_title($post->post_parent);?>
</li>
<li class="reply-count">
<?php echo bbp_get_topic_post_count($post->ID, false);?> Replies
</li>
<li class="voice-count">
<?php echo bbp_get_topic_voice_count($post->ID, false); ?> Participants
</li>
<li class="topic-freshness-author">
Last Activity <?php echo bbp_get_topic_last_active_time($post->ID, false); ?>
</li>
<li class="topic-subscription-link"><?php bbp_topic_subscription_link(); ?></li>
<li class="topic-favorites-link"><?php bbp_user_favorites_link(); ?></li>
</ul>
<?php
return ob_get_clean();
}
}
add_shortcode( 'bbpress-topic-info', 'bbpress_topic_info_func' );
/**
* bbpress subscription link | hide
* From https://bbpress.org/forums/topic/is-there-a-way-to-remove-this-character-next-to-the-subscription-link/
*/
function hide_before ($args = array() ) {
$args['before'] = '';
return $args;
}
add_filter ('bbp_before_get_forum_subscribe_link_parse_args','hide_before') ;
You can use this short code like this [bbpress-topic-info]
Need Help with Your Digital Presence?
At Dynamic Web Lab, we specialize in building fast, scalable websites and applications for businesses across the UAE and beyond.
- View our case studies to see recent projects
- Explore our services — from WordPress to Next.js, AI solutions to mobile apps
- Contact us for a free consultation
Whether you need a WordPress website, a custom Next.js application, or AI-powered solutions, our team is ready to help.
Written by
Dynamic Web Lab Editorial
We share how we design, engineer, and scale digital products across the GCC, Europe, and the US.
Need help implementing this?
We turn these playbooks into shipped features. Let us scope your roadmap and support your team.
Start a project conversation