apply_filters( 'wpml_get_element_translations', mixed $empty_value, integer $trid, string $element_type)
- 유형
- filter
- 카테고리
- 사이트 전체 언어 정보
- WPML 버전
- 3.3.5
설명
trid(번역 그룹의 ID)를 사용하여 요소 번역 정보를 가져오세요.trid은(는) wpml_element_trid 필터를 통해 가져올 수 있습니다.- 이에 대한 자세한 내용은 WPML의 테이블 문서 페이지에서 확인하세요.
인수
- $empty_value
- (mixed) (필수) 일반적으로 필터가 수정할 값입니다. 여기서는 아무것도 필터링하지 않으므로 NULL로 설정하세요. 이는 필터 함수가 전체 인수 목록을 실제로 수신하도록 하기 위함입니다.
- $trid
- (integer) (필수) 번역 그룹의 ID입니다.
- $element_type
- (string) (선택 사항) 요소의 유형입니다. 글 유형(post_post, post_page, post_attachment, post_nav_menu_item, post_{custom post key}) 또는 택소노미(tax_category, tax_post_tag, tax_nav_menu, tax_{custom taxonomy key})일 수 있습니다. 설정하지 않으면 기본값은
post_post입니다.
사용 예시
예제
$translations = apply_filters( 'wpml_get_element_translations', NULL, 2, 'post_page' );
var_dump($translations);
/**
* The result looks like the following
*
array(2) {
["en"]=>
object(stdClass)#1857 (8) {
["translation_id"]=>
string(1) "1"
["language_code"]=>
string(2) "en"
["element_id"]=>
string(1) "2"
["source_language_code"]=>
NULL
["element_type"]=>
string(9) "post_page"
["original"]=>
string(1) "1"
["post_title"]=>
string(4) "Home"
["post_status"]=>
string(7) "publish"
}
["es"]=>
object(stdClass)#1856 (8) {
["translation_id"]=>
string(3) "141"
["language_code"]=>
string(2) "es"
["element_id"]=>
string(3) "187"
["source_language_code"]=>
string(2) "en"
["element_type"]=>
string(9) "post_page"
["original"]=>
string(1) "0"
["post_title"]=>
string(6) "Inicio"
["post_status"]=>
string(7) "publish"
}
}
*/
관련 훅
wpml_decode_custom_field, wpml_footer_language_selector, wpml_add_language_form_field, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages