Info
- 5 posts
- 2 voices
- Started 3 years ago by Ipstenu
- Latest reply from Ipstenu
- This topic is resolved
Customize Topic Labels
-
- Posted 3 years ago #
In bb-includes/formatting-functions.php the values of the closed and sticky labels are hard coded:
function bb_closed_label( $label ) { global $topic; if ( '0' === $topic->topic_open ) return sprintf(__('[closed] %s'), $label); return $label; }I want to change 'closed' to 'Read Only'. I know I can just hack the file, but there should be a way to use theme functions and I'm just not thawed out enough to think of it.
-
- Posted 3 years ago #
You don't have to hack anything, it's done via a filter.
ie.
add_filter('bb_topic_labels', 'bb_closed_label', 10); add_filter('bb_topic_labels', 'bb_sticky_label', 20);
simply remove the filter via a plugin and replace it with your own routine.remove_filter('bb_topic_labels', 'bb_closed_label'); add_filter('bb_topic_labels', 'my_closed_label'); function my_closed_label( $label ) { global $topic; if ( '0' === $topic->topic_open ) return sprintf(__('[Read Only] %s'), $label); return $label; } -
- Posted 3 years ago #
Doy!
I put that in functions.php in my theme and it works. Thanks!
I need to thaw my brain out.
-
- Posted 3 years ago #
Okay, now it's weird. It works perfect for bb_closed_label, but
remove_filter('bb_topic_labels', 'bb_sticky_label');does nothing.What I tried was
remove_filter('bb_topic_labels', 'bb_sticky_label'); function my_sticky_label( $label ) { global $topic; if (is_front()) { if ( '2' === $topic->topic_sticky ) { return sprintf(__('<img src="/images/sticky.png" /> %s'), $label); } } else { if ( '1' === $topic->topic_sticky || '2' === $topic->topic_sticky ) { return sprintf(__('<img src="/images/sticky.png" /> %s'), $label); } } return $label; } add_filter('bb_topic_labels', 'my_sticky_label');When I do that I get [sticky] and then my image. Which is close...
-
- Posted 3 years ago #
remove_filter('bb_topic_labels', 'bb_sticky_label', 20);worked.Now it has images :)
-
You must log in to post.