تخطي التنقل

Open

Overview of the issue

When using the uDesign theme and the uDesign Image Gallery Elementor’s widget, image captions are not being translated on the front end, even though the translations exist.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open your theme’s functions.php file.
    // WPML Workaround for compsupp-7754
    add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7754');
      
    function wpml_compsupp7754($element) {
        if ( 'udesign_widget_imagegallery' !== $element->get_name() ) {
            return;
        }
      
        $settings = $element->get_settings();
      
        if ( isset( $settings['images'] ) && is_array( $settings['images'] ) ) {
            foreach ( $settings['images'] as $key => $value ) {   
                if ( is_array($value) && isset( $value['id'] ) ) {
                    $post_type = get_post_type( $value['id']);      
                    if ( $post_type ) {
                        $translated_id = apply_filters( 'wpml_object_id', $value['id'], $post_type, true );
                        $settings['images'][$key]['id'] = $translated_id;
                    }
                }
                  
            }
      
            $element->set_settings( 'images', $settings['images'] );
        }
    }
            

اترك ردًا

الرجاء البقاء في الموضوع واحترام الآخرين. إذا كنت بحاجة إلى مساعدة في مشكلات غير متعلقة بهذا المنشور، استخدم منتدى الدعم الخاص بنا لبدء محادثة أو إرسال تذكرة.

يمكنك استخدام هذه العلامات:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>