Passer la navigation

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'] );
        }
    }
            

Laisser une réponse

Veuillez rester dans le sujet et être respectueux envers les autres. Si vous avez besoin d'aide pour des problèmes non liés à ce message, utilisez notre Forum de support pour commencer une discussion ou soumettre un ticket.

Vous pouvez utiliser ces balises :
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>