- Stato
- Risolto dall’autore
- Risolto in
- Themify Ultra 8.0.1
- Plugin/tema correlato
- Themify Ultra
- Tag dell’argomento
- Compatibility
Panoramica del problema
Quando si traduce una pagina usando WPML con il modulo Feature Content nel tema Themify Ultra, i testi ALT delle immagini non vengono tradotti sul front-end.
Soluzione alternativa
Assicurati di avere un backup completo del sito prima di procedere.
- Apri il file …/wp-content/themes/themify-ultra/themify/themify-builder/classes/class-themify-builder-model.php.
- Cerca la riga 357.
- Sostituisci:
public static function get_alt_by_url(string $image_url):string { $attachment_id = themify_get_attachment_id_from_url($image_url); if ($attachment_id && ($alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true))) { return $alt; } return ''; } - Con:
public static function get_alt_by_url(string $image_url):string { $attachment_id = themify_get_attachment_id_from_url($image_url); // WPML Workaround for wpmlsupp-12600 if ( class_exists('Sitepress') ) { $current_lang = apply_filters( 'wpml_current_language', NULL ); $attachment_id = apply_filters( 'wpml_object_id', $attachment_id, 'post', TRUE, $current_lang ); } if ($attachment_id && ($alt = get_post_meta($attachment_id, '_wp_attachment_image_alt', true))) { return $alt; } return ''; }