- สถานะ
- แก้ไขแล้ว
- รายงานสำหรับ
- WPML Multilingual for CF7 1.2.1
- แก้ไขใน
- Contact Form 7 Multilingual 1.2.2
- ปลั๊กอิน/ธีมที่เกี่ยวข้อง
- Contact Form 7
- แท็กหัวข้อ
- Compatibility
ภาพรวมของปัญหา
เมื่อเพิ่มฟอร์มโดยใช้ปลั๊กอิน Contact Form 7 และเมธอด PHP do_shortcode() ฟอร์มจะไม่แสดงผลการแปลตามที่คาดไว้
วิธีแก้ปัญหาชั่วคราว
โปรดตรวจสอบให้แน่ใจว่าคุณได้สำรองข้อมูลทั้งหมดของไซต์ก่อนดำเนินการต่อ
- เปิดไฟล์ …/wp-content/plugins/contact-form-7-multilingual/classes/shortcodes.php
- ค้นหาบรรทัดที่ 21
- แทนที่:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; } - ด้วย:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) && is_numeric($atts['id']) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ($form == null){ $form = wpcf7_get_contact_form_by_hash( $atts['id']); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; }