WPML
Status
Vom Autor gelöst
Gelöst in
Themify Ultra 8.0.1
Zugehöriges Plugin/Theme
Themify Ultra
Themen-Tags
Compatibility

Übersicht über das Problem

Beim Übersetzen einer Seite mit WPML und dem Feature Content-Modul im Themify Ultra Theme wird der ALT-Text für Bilder im Frontend nicht übersetzt.

Problemumgehung

Bitte stellen Sie sicher, dass Sie über ein vollständiges Backup Ihrer Website verfügen, bevor Sie fortfahren.


  • Öffnen Sie die Datei …/wp-content/themes/themify-ultra/themify/themify-builder/classes/class-themify-builder-model.php.

  • Suchen Sie nach Zeile 357.

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


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

Alle bekannten Probleme →