WPML

문제 개요

Themify Ultra 테마에서 Feature Content module과 함께 WPML을 사용하여 페이지를 번역할 때, 프런트엔드에서 이미지의 ALT 텍스트가 번역되지 않습니다.

임시 해결 방법

이 문제는 Themify Ultra 8.0.1에서 해결되었습니다. 업데이트하면 사이트에서 문제가 해결되므로, 아직 업데이트할 수 없는 경우에만 이 임시 해결 방법이 필요합니다.

진행하기 전에 전체 사이트 백업을 완료하세요.

  • …/wp-content/themes/themify-ultra/themify/themify-builder/classes/class-themify-builder-model.php 파일을 여세요.
  • 357번째 줄을 찾으세요.
  • 다음 코드를:
    PHP
    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 '';
    }
  • 다음과 같이 변경하세요:
    PHP
    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 '';
    }

모든 알려진 문제

여전히 이 문제가 발생합니까?

업데이트해도 문제가 해결되지 않으면 지원 문의를 하세요. 함께 살펴보겠습니다.