문제 개요
WPML과 함께 WP Configurator Pro를 사용할 때 다음과 같은 문제가 발생할 수 있습니다: 구성기에 연결된 번역된 WooCommerce 상품에서 구성기의 제목이 상품 제목을 대체하고 구성기 설명은 영어로 유지되며, PDF 텍스트를 번역할 수 없습니다.
임시 해결 방법
자식 테마의 functions.php 파일에 다음 코드를 추가하세요:
PHP
add_filter( 'the_title', function ( $title, $id = 0 ) {
if ( ( is_admin() && ! wp_doing_ajax() ) || ! $id || 'product' !== get_post_type( $id ) ) {
return $title;
}
$post = get_post( $id );
return $post ? $post->post_title : $title;
}, 11, 2 );
add_filter( 'do_shortcode_tag', function ( $out, $tag, $attr ) {
if ( 'wpc_config_description' !== $tag || empty( $attr['id'] ) ) {
return $out;
}
$id = absint( $attr['id'] );
return wp_kses_post( apply_filters( 'wpc_single_product_description', get_post_meta( $id, '_wpc_description', true ), $id ) );
}, 10, 3 );WPML설정으로 이동하여 사용자 정의 XML 구성에 다음을 추가하세요:
XML
<wpml-config>
<admin-texts>
<key name="wpc_pdf_document_heading" />
<key name="wpc_pdf_download_btn_text" />
</admin-texts>
</wpml-config>그런 다음 WPML문자열 번역에서 텍스트를 번역하세요.