Salta la navigazione

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

Lascia una risposta

Per favore rimani in argomento e sii rispettoso verso gli altri. Se hai bisogno di aiuto con problemi non correlati a questo post, usa il nostro Forum di Supporto per iniziare una chat o inviare un ticket.

Puoi usare questi tag:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>