Edit bbpress notification
-
How do I change the text from “This forum contains xxx topics…etc”? I can’t seem to locate it.
Thank you.
-
Anybody? *bump* *bump*
it’s in
/includes/forums/template.php
lines
1987, 1995, 2007, 2017
You could probably filter it by
//This function changes the text wherever it is quoted function change_translate_text( $translated_text ) { if ( $translated_text == 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.' ) { $translated_text = 'This elephant contains %1$s and %2$s, and was last giraffed by %3$s %4$s.'; } if ( $translated_text == 'This forum contains %1$s, and was last updated by %2$s %3$s.' ) { $translated_text = 'This elephant contains %1$s, and was last giraffed by %2$s %3$s.'; } if ( $translated_text == 'This forum contains %1$s and %2$s.' ) { $translated_text = 'This elephant contains %1$s and %2$s.'; } if ( $translated_text == 'This forum contains %1$s.' ) { $translated_text = 'This elephant contains %1$s.'; } return $translated_text; } add_filter( 'gettext', 'change_translate_text', 20 );
in your functions file
Thank you so much @robin-w, you’ve helped me several times. I appreciate it.
Well…I’ve run into a problem. I have this code that removed the word “ago” from the freshness layout:
function change_translate_text( $translated_text ) { if ( $translated_text == '%s ago') { $translated_text = '%s'; } return $translated_text; } add_filter( 'gettext', 'change_translate_text', 20 );
The only place I want to include the word “ago” is on the top of the forum within the forum data block. Right now it reads: This forum contains x topics, and x replies, and was last updated by x 4 minutes.
When I use the code above and manually add the word ago at the end of the line, I get an error because it was already declared. Is there a way around this? Thank you.
yes, it is only already declared because I used the same function name.
Just combine the two and you get
//This function changes the text wherever it is quoted function change_translate_text( $translated_text ) { if ( $translated_text == '%s ago') { $translated_text = '%s'; } if ( $translated_text == 'This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.' ) { $translated_text = 'This elephant contains %1$s and %2$s, and was last giraffed by %3$s %4$s.'; } if ( $translated_text == 'This forum contains %1$s, and was last updated by %2$s %3$s.' ) { $translated_text = 'This elephant contains %1$s, and was last giraffed by %2$s %3$s.'; } if ( $translated_text == 'This forum contains %1$s and %2$s.' ) { $translated_text = 'This elephant contains %1$s and %2$s.'; } if ( $translated_text == 'This forum contains %1$s.' ) { $translated_text = 'This elephant contains %1$s.'; } return $translated_text; } add_filter( 'gettext', 'change_translate_text', 20 );
- You must be logged in to reply to this topic.