Skip to:
Content

Opened 4 years ago

Closed 2 years ago

#2760 closed enhancement (fixed)

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

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

Description

Hi,
I posted yesterday this bug (https://bbpress.trac.wordpress.org/ticket/2759) 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 (http://codex.wordpress.org/Function_Reference/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 2 years ago.
adds a hook to filter the subforum classes in bbp_list_forums()

Download all attachments as: .zip

Change History (4)

#1 @netweb
4 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: https://codex.wordpress.org/Function_Reference/post_class

e.g.

<?php
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 4 years ago by netweb (previous) (diff)

#2 @gordie.lachance
2 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() :

<?php
// 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.

@gordie.lachance
2 years ago

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

#3 @johnjamesjacoby
2 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.