You can use the following three filters:
bbp_get_forum_class
bbp_get_topic_class
bbp_get_reply_class
Each of them function exactly like the core WordPress post_class filter: https://codex.wordpress.org/Function_Reference/post_class
How do we implement this? I tried replacing
<ul id="bbp-topic-<?php bbp_topic_id(); ?>" <?php bbp_topic_class(); ?>>
with
<ul id="bbp-topic-<?php bbp_topic_id(); ?>" <?php echo bbp_get_topic_class('test-class'); ?>>
but the test class doesn’t show. I know I’m working with the right line of code because I can remove the class part altogether and see it removed from my site.
I figured this out. I had to add this in my bbpress_functions:
function my_topic_class($classes) {
$classes[] = 'test-class';
return $classes;
}
add_filter( 'bbp_get_topic_class','my_topic_class' );