WPML
สถานะ
เปิด
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
Filter Everything PRO
แท็กหัวข้อ
Compatibility

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

ผู้ใช้ปลั๊กอิน Filter Everything ที่ใช้ร่วมกับ Advanced Custom Fields อาจพบปัญหาที่ค่าฟิลด์ของ ACF ที่ใช้ในตัวกรองไม่ได้รับการแปลในส่วนหน้า ปัญหานี้เกิดขึ้นแม้ว่าจะมีการแปลฟิลด์ดังกล่าวภายใน WPML การแปลสตริงแล้วก็ตาม

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

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


  • เพิ่มโค้ดต่อไปนี้ลงในไฟล์ functions.php ของธีม:
    // WPML Workaround for compsupp-7581
    add_filter('wpc_terms_before_display', 'wpml_compsupp7581_filter_wpc_filter_terms', 10, 4 ); 
    
    function wpml_compsupp7581_filter_wpc_filter_terms($terms, $filter, $set, $urlManager) {
    	
    	if ( class_exists('Sitepress') ) {
    		foreach ($terms as &$term ) {
    			$label = $term->name;
    			$textdomain = 'WordPress';
    			$string_name = 'WPC Filter Label: '.substr($label, 0, 40);
    
    			if ( apply_filters('wpml_default_language', NULL ) == apply_filters( 'wpml_current_language', NULL )) {
    				do_action( 'wpml_register_single_string', $textdomain, $string_name, $label );
    			}	
    			// Apply the translation to the string
    			$term->name = apply_filters('wpml_translate_single_string', $label , $textdomain, $string_name);
    
    		}
    	}
    	return $terms;
    }

  • ไปที่หน้าเว็บที่มีปัญหาในภาษาต้นฉบับ การดำเนินการนี้จะลงทะเบียนสตริงข้อความ

  • ไปที่หน้า WPML > การแปลสตริง และแปลสตริงข้อความดังกล่าว ซึ่งควรอยู่ภายใต้ WordPress textdomain

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