- Stato
- Risolto dall’autore
- Plugin/tema correlato
- Hestia Pro
- Tag dell’argomento
- Compatibility
Panoramica del problema
Quando aggiungi le Testimonianze nella sezione Personalizza con il tema Hestia Pro, queste appaiono tutte combinate in un’unica grande stringa nella pagina WPML > Traduzione stringhe, rendendole difficili da tradurre singolarmente.
Soluzione alternativa
Assicurati di avere un backup completo del tuo sito prima di procedere.
- Aggiungi il seguente snippet al file functions.php del tema:
// WPML Workaround for compsupp-6971 function wpml_compsupp6971_translate_strings_from_hestia($original_value, $domain) { if( class_exists('Sitepress') ){ $string = $original_value; $textdomain = 'hestia-pro'; $string_name = $domain.': '.substr($string, 0, 20); $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', $textdomain, $string_name, $string ); } // Apply the translation to the string $wpml_translation = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name); return $wpml_translation; } return $original_value; } add_filter( 'hestia_translate_single_string', 'wpml_compsupp6971_translate_strings_from_hestia', 11, 2 ); - Visita la pagina nel front-end per registrare le stringhe.
- Vai alla pagina WPML > Traduzione stringhe e traduci le stringhe