Rename Lables

function learn_gettext( $translation, $text ) {
    $dirty = false;
    $strings_map = array(
        'group'     => 'class',
        'groups'    => 'classes',
        'Group'     => 'Class',
        'Groups'    => 'Classes',
        'course'     => 'lesson',
        'courses'    => 'lessons',
        'Course'     => 'Lesson',
        'Courses'    => 'Lessons',
        'assignment'     => 'tests',
        'assignments'    => 'tests',
        'Assignment'     => 'Test',
        'Assignments'    => 'Tests'
    );
    $text_words = explode( ' ', $text );
    // Try to find strings to be replaced and preserve the punctuation
    foreach ( $text_words as $k => $word ) {
        $w = trim( $word, '.,:!?-_()' );
        if ( isset( $strings_map[ $w ] ) ) {
            $text_words[ $k ] = str_replace( $w, $strings_map[ $w ], $word );
            $dirty = true;
        }
    }
    if ( $dirty ) {
        return implode( ' ', $text_words );
    }
    return $translation;
}
add_filter( 'gettext', 'learn_gettext', 10, 2 );
Advertisements

Rename Labels for Buddypress Groups Tabs

function jm_move_group_activity_tab() {
  global $bp;
  if (isset($bp->groups->current_group->slug) && $bp->groups->current_group->slug == $bp->current_item) {
//    $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['position'] = '98';
    $bp->bp_options_nav[$bp->groups->current_group->slug]['home']['name'] = 'Activity';
    $bp->bp_options_nav[$bp->groups->current_group->slug]['forum']['name'] = 'Discussion';
  }
}
add_action('bp_init', 'jm_move_group_activity_tab');