Skip to:

Opened 9 years ago

Closed 7 years ago

#2760 closed enhancement (fixed)

topics/forums/subforums/replies hentries (and links)... CSS classes should not be hardcoded

Reported by: grosbouff's profile grosbouff Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6 Priority: normal
Severity: normal Version: trunk
Component: API - Actions/Filters Keywords:
Cc: gordie.lachance@…


I posted yesterday this bug ( but the problem is bigger than that.
I think that it is an absolute necessity (for creating bbPress plugins) that CSS classes for topics/forums/subforums/... entries and links are not hardcoded (eg. bbp-forum-title, bbp-topic-permalink, bbp-reply-permalink, bbp-reply-header, bbp-lead-topic, and others)
This is a real barrier for plugins creator.

Classes for those items should be set like in Wordpress, using the function post_class ( or a similar one.

We should be able to filter the classes set for topics / forums / subforums / replies, ...

Attachments (1)

subforum-classes.2760.diff (1.0 KB) - added by gordie.lachance 8 years ago.
adds a hook to filter the subforum classes in bbp_list_forums()

Download all attachments as: .zip

Change History (4)

#1 @netweb
9 years ago

  • Milestone Awaiting Review deleted
  • Priority changed from high to normal
  • Resolution set to worksforme
  • Status changed from new to closed

You can already use the following filters: bbp_get_forum_class, bbp_get_topic_class & bbp_get_reply_class

Each of them do mirror WordPress' post_class filter:


function my_unread_class( $classes ) {
        $classes[] = 'my-unread-test-class';
        return $classes;
add_filter( 'bbp_get_forum_class','my_unread_class' );
add_filter( 'bbp_get_topic_class','my_unread_class' );
add_filter( 'bbp_get_reply_class','my_unread_class' );

Related: #2759

Last edited 9 years ago by netweb (previous) (diff)

#2 @gordie.lachance
8 years ago

  • Cc gordie.lachance@… added
  • Milestone set to 2.6
  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Version set to trunk

Hi @netweb, the classes still are hardcoded in some places, for example in function bbp_list_forums() :

// Build this sub forums link
$output .= $r['link_before'] . '<a href="' . esc_url( $permalink ) . '" class="bbp-forum-link">' . $title . $counts . '</a>' . $show_sep . $r['link_after'];

I made a patch for this one, it is attached to this ticket.

8 years ago

adds a hook to filter the subforum classes in bbp_list_forums()

#3 @johnjamesjacoby
7 years ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from reopened to closed

In 6315:

Forums: Introduce bbp_list_forums_subforum_classes filter, to allow filtering of sub-forum links.

Props gordielachance. Fixes #2760.

Note: See TracTickets for help on using tickets.