- สถานะ
- แก้ไขแล้ว
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- Elementor
ภาพรวมของปัญหา
หากคุณมีวิดเจ็ต shortcode ที่มีเนื้อหาใน Elementor และแปลหน้าโดยใช้ตัวแก้ไขการแปลของ WPML เนื้อหาของ shortcode จะไม่สามารถแปลได้
วิธีแก้ปัญหาชั่วคราว
เรากำลังดำเนินการแก้ไขปัญหานี้ ในระหว่างนี้ คุณสามารถแก้ไขได้โดยเพิ่มโค้ดนี้ลงในไฟล์ functions.php ของธีม
add_action('init', function (){
add_filter( 'wpml_elementor_widgets_to_translate', 'shortcode_widget_registration' );
});
/**
* Translate Shortcodes widget by elementor
* @param array $widgets
* @return array
*/
function shortcode_widget_registration($widgets) {
$widgets['shortcode'] = [
'conditions' => ['widgetType' => 'shortcode'],
'fields' => [
[
'field' => 'shortcode',
'type' => __('Enter your shortcode', 'sitepress'),
'editor_type' => 'AREA'
],
],
];
return $widgets;
}
หลังจากนั้น ให้แก้ไขหน้าในภาษาต้นฉบับแล้วอัปเดตการแปล และคุณจะพบว่าเนื้อหาของวิดเจ็ต Shortcode พร้อมสำหรับการแปล