ภาพรวมของปัญหา
เมื่อใช้ WP Configurator Pro ร่วมกับ WPML คุณอาจพบปัญหาต่อไปนี้: ในสินค้า 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การแปลสตริง