WPML
Stato
In attesa dell’autore
Plugin/tema correlato
Unlimited Elements for Elementor
Tag dell’argomento
Compatibility

Panoramica del problema

Quando si utilizza il widget Post Carousel del plugin Unlimited Elements for Elementor su un sito con WPML, il widget non riesce a recuperare gli articoli tradotti, causando problemi di visualizzazione dei contenuti nelle pagine tradotte.

Soluzione alternativa

Assicurati di avere un backup completo del tuo sito prima di procedere.


  • Apri il file functions.php del tuo tema.

  • Aggiungi il seguente codice:
    // WPML Workaround for compsupp-7126
    add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7126_filter_ucaddon_post_carousel');
    
    function wpml_compsupp7126_filter_ucaddon_post_carousel($element) {
        if ( 'ucaddon_post_carousel' !== $element->get_name() ) {
            return;
        }
    
        $settings = $element->get_settings();
    
        if ( isset( $settings['post_manual_select_post_ids'] ) && is_array( $settings['post_manual_select_post_ids'] ) ) {
            foreach ( $settings['post_manual_select_post_ids'] as $key => $id ) {      
    
                $post_type = get_post_type( $id );
    
                if ( ! $post_type ) {
                    continue;
                }
    
                $id = apply_filters( 'wpml_object_id', $id, $post_type, true );
    
                unset($settings['post_manual_select_post_ids'][$key]);
                $settings['post_manual_select_post_ids'][] = $id;
            }
    
            $element->set_settings( 'post_manual_select_post_ids', $settings['post_manual_select_post_ids'] );
        }
    }

Tutti i problemi noti →