Reply To: Help changing contact in profile!!
It’s best to make your changes in the language file.
If you only want to change a label or two, you can use functions. The tricky part is knowing which filter hooks to use: gettext or gettext_with_context.
In your case, you need both:
function example_gettext_with_context( $translated, $text, $context, $domain ) {
if ( 'buddypress' !== $domain )
return $translated;
switch ( $text ) {
case 'Friends':
return 'Contacts';
default:
return $translated;
}
}
add_filter( 'gettext_with_context', 'example_gettext_with_context', 11, 4 );
function example_gettext( $translated, $original_text, $domain ) {
if ( 'buddypress' !== $domain )
return $translated;
switch ( $original_text ) {
case 'Friends <span class="%s">%s</span>';
return 'Contacts <span class="%s">%s</span>';
default:
return $translated;
}
}
add_filter( 'gettext', 'example_gettext', 10, 3 );