Add “Resolved” to Closed Topics in bbPress
by Bandicoot Marketing on | Posted in Tutorials | 3 comments
Since Margot’s been born, I’ve been having a hard time wrapping my brain around anything other than being a dad to her and her older sister Abby. I forgot about writing anything in May and thought I should at least put something up, even if it isn’t too elaborate.
I know there are probably better ways to accomplish displaying a topic in bbPress as resolved, but I didn’t want to go into adding any additional functionality. In the end, all I did was hook into bbp_theme_before_topic_title
to check to see if the topic is closed. If it is, add “Resolved” before the title.
Here’s the code:
add_action( 'bbp_theme_before_topic_title', 'bavotasan_resolved_topics' ); /** * Add "Resolved" to closed topics * * This function is attached to the 'bbp_theme_before_topic_title' action hook. * @author c.bavota */ function bavotasan_resolved_topics() { $topic_id = bbp_get_topic_id(); if ( get_post_type( $topic_id ) == bbp_get_topic_post_type() && bbp_is_topic_closed( $topic_id ) ) echo '<span class="resolved">[Resolved]</span>'; }
I use Font Awesome on my theme site and wanted a little icon before the resolved text so my actual code for the echoed line looks like this:
echo '<span class="resolved"><i class="fa fa-check"></i> [Resolved]</span>';
It’s a simple mod for bbPress that makes it easier to see which topics have actually been closed. And by closed I mean resolved. 😉
3 comments for “Add “Resolved” to Closed Topics in bbPress”