WPML
สถานะ
รอผู้พัฒนา
ปลั๊กอิน/ธีมที่เกี่ยวข้อง
Unlimited Elements for Elementor
แท็กหัวข้อ
Compatibility

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

เมื่อใช้งานวิดเจ็ต Post Carousel จากปลั๊กอิน Unlimited Elements for Elementor บนไซต์ที่มี WPML วิดเจ็ตจะไม่สามารถดึงโพสต์ที่แปลแล้วได้ ส่งผลให้เกิดปัญหาการแสดงเนื้อหาบนหน้าที่แปล

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

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


  • เปิดไฟล์ functions.php ของธีม

  • เพิ่มโค้ดต่อไปนี้:
    // WPML Workaround for compsupp-7126
    add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7126_filter_ucaddon_post_carousel');
    
    function wpml_compsupp7126_filter_ucaddon_post_carousel($element) {
        if ( 'ucaddon_post_carousel' !== $element->get_name() ) {
            return;
        }
    
        $settings = $element->get_settings();
    
        if ( isset( $settings['post_manual_select_post_ids'] ) && is_array( $settings['post_manual_select_post_ids'] ) ) {
            foreach ( $settings['post_manual_select_post_ids'] as $key => $id ) {      
    
                $post_type = get_post_type( $id );
    
                if ( ! $post_type ) {
                    continue;
                }
    
                $id = apply_filters( 'wpml_object_id', $id, $post_type, true );
    
                unset($settings['post_manual_select_post_ids'][$key]);
                $settings['post_manual_select_post_ids'][] = $id;
            }
    
            $element->set_settings( 'post_manual_select_post_ids', $settings['post_manual_select_post_ids'] );
        }
    }

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