WPML
Trạng thái
Đã được giải quyết bởi nhà phát triển
Plugin/giao diện liên quan
CozyStay
Thẻ chủ đề
Compatibility

Tổng quan về lỗi

Trong giao diện CozyStay, việc dịch văn bản thay thế cho hình ảnh thư viện bằng WPML không hoạt động như mong đợi. Mặc dù đã dịch văn bản thay thế thông qua Trình biên tập dịch thuật nâng cao (ATE), các văn bản thay thế đã dịch không hiển thị trên frontend của các trang đã dịch.

Giải pháp tạm thời

Vui lòng đảm bảo bạn đã tạo bản sao lưu toàn bộ trang web trước khi tiếp tục.


  • Mở tệp functions.php trong giao diện của bạn.

  • Thêm mã sau:
    // WPML Workaround for compsupp-7616
    add_filter('elementor/frontend/before_render', 'wpml_compsupp7616_filter_image_gallery_widget');
    
    function wpml_compsupp7616_filter_image_gallery_widget($element) {
    
        if ('cs_gallery' !== $element->get_name()) {
            return;
        }
    
        $settings = $element->get_settings();
    
        if (isset($settings['gallery']) && is_array($settings['gallery'])) {
            foreach ($settings['gallery'] as $key => $image) {
                if (isset($image['id'])) {
                    $post_type = get_post_type($image['id']);
    
                    if (!$post_type) {
                        continue;
                    }
    
                    $settings['gallery'][$key]['id'] = apply_filters('wpml_object_id', $image['id'], $post_type, true);
                }
            }
    
            $element->set_settings('gallery', $settings['gallery']);
        }
    }

Tất cả các lỗi đã ghi nhận →