דלג על ניווט

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>