WPML
Stato
In attesa dell’autore
Plugin/tema correlato
FacetWP
Tag dell’argomento
Compatibility

Panoramica del problema

Se utilizzi il plugin FacetWP, potresti riscontrare un problema per cui le etichette dei campi checkbox, creati con ACF e utilizzati nei facet di FacetWP, non mostrano le relative traduzioni quando vengono inseriti nelle pagine tramite gli shortcode di Elementor.

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:
    Add the following code to the functions.php file
    // WPML Workaround for compsupp-6751
    function wpml_compsupp6751_translate_facet_display_value( $label, $args ) {
    	if ( class_exists('Sitepress') ) {
    		$wpml_default_lang = apply_filters('wpml_default_language', NULL );
    		$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
    
    		if ($wpml_default_lang == $wpml_current_lang ) {
    			do_action( 'wpml_register_single_string', 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10), $label );
    		}	
    		// Apply the translation to the string
    		$label = apply_filters('wpml_translate_single_string', $label , 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10) );
    	}
        return $label;
    }
    add_filter( 'facetwp_facet_display_value', 'wpml_compsupp6751_translate_facet_display_value', 10, 2 );
  • Visita la pagina nel front-end nella lingua originale per registrare le stringhe
  • Vai su WPML > Traduzione stringhe e traduci le stringhe (dominio di testo FacetWP / Facet Display Value : * name)

Tutti i problemi noti →