WPML
สถานะ
รอผู้พัฒนา
แท็กหัวข้อ
Compatibility

ภาพรวมของปัญหา

เมื่อใช้งาน eRecht24 legal texts for WordPress ร่วมกับ WPML ข้อความทางกฎหมายที่เพิ่มผ่าน shortcode ของ eRecht24 หรือวิดเจ็ต Elementor อาจแสดงในภาษาที่ไม่ถูกต้อง สิ่งนี้อาจเกิดขึ้นได้เนื่องจากจำเป็นต้องตั้งค่าภาษาในการตั้งค่า shortcode ของ eRecht24 หรือวิดเจ็ต

ภาษาของ WPML จะไม่ถูกนำมาใช้ในส่วนนี้ ดังนั้นคุณอาจต้องแก้ไขการแปลของคุณด้วยตนเองเพื่อเลือกภาษาที่ถูกต้องใน shortcode หรือวิดเจ็ต

วิธีแก้ปัญหาชั่วคราว

โปรดตรวจสอบให้แน่ใจว่าได้สำรองข้อมูลไซต์ทั้งหมดของคุณก่อนดำเนินการต่อ

  • เพิ่มโค้ดต่อไปนี้ลงในไฟล์ functions.php ของธีม
 
// WPML - Workaround for compsupp-8368 use the shortcode_atts_{$shortcode} filter to change 'lang' to the current language or fallback to English
add_filter( 'shortcode_atts_erecht24', function ( $out, $pairs, $atts, $shortcode ) {
	if ( ! class_exists( 'SitePress' ) ) {
		return $out;
	}

	$current_lang = apply_filters( 'wpml_current_language', null );
	$out['lang'] = in_array( $current_lang, array( 'de', 'en' ), true ) ? $current_lang : 'en';

	return $out;
}, 10, 4 );

ปัญหาที่ทราบแล้วทั้งหมด →