WPML
Estado
Resuelto por el autor
Resuelto en
Themify Ultra 8.0.1
Plugin/tema relacionado
Themify Ultra
Etiquetas de temática
Compatibility

Resumen del problema

Al traducir una página usando WPML con el módulo Feature Content en el tema Themify Ultra, el texto ALT de las imágenes no se traduce en el front-end.

Solución alternativa

Por favor, asegúrese de tener una copia de seguridad completa de su sitio antes de continuar.


  • Abra el archivo …/wp-content/themes/themify-ultra/themify/themify-builder/classes/class-themify-builder-model.php.

  • Busque la línea 357.

  • Reemplace:
        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 '';
        }
            


  • Por:
        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 '';
        }
            

Todos los problemas conocidos →