WPML
상태
해결됨
보고된 제품
WPML Multilingual for BuddyPress and BuddyBoss 1.7.0
해결된 버전
BuddyPress Multilingual 1.8.0
관련 플러그인/테마
BuddyPress

문제 개요

BuddyPress 플러그인을 사용하면 새 프로필 필드를 생성하고 WPML의 BuddyPress Multilingual 글루 플러그인을 사용하여 번역할 수 있습니다. 그러나 WPML문자열 번역에서 해당 필드가 번역된 것으로 표시되더라도 프런트엔드에서는 번역이 표시되지 않습니다.

임시 해결 방법

진행하기 전에 반드시 사이트를 전체 백업하세요.

  1. functions.php 파일에 다음 코드를 추가하세요.
     //WPML Workaround wpml_compsupp6144
    add_filter( 'bp_get_the_profile_field_value', 'wpml_compsupp6144_translate_buddypress_profile_fields', 10, 3 ); 
     
    function wpml_compsupp6144_translate_buddypress_profile_fields( $value, $type, $id ) {
         
        if ($type == 'textbox' || $type == 'wp-textbox' || $type == 'wp-biography') {
            //remove html tags from value and limit it's size, so we can use it as string name
            $filtered_value = substr(strip_tags($value), 0, 60);
            //register string
            do_action( 'wpml_register_single_string', 'BuddyPress Profile Fields', $type.' - '.$filtered_value , $value );
            //translate string
            $value = apply_filters('wpml_translate_single_string', $value, 'BuddyPress Profile Fields', $type.' - '.$filtered_value  );
        }   
        
        return $value;
    } 
  2. 프런트엔드에서 프로필 페이지를 방문하세요. 이렇게 하면 번역할 필드가 등록됩니다.
  3. WPML문자열 번역으로 이동하여 BuddyPress Profile Fields 도메인의 필드 값을 번역하세요.
  4. 프런트엔드의 프로필 페이지로 돌아가세요. 이제 필드가 번역됩니다.

알려진 모든 문제 →