WPML
상태
개발자가 해결함
해결된 버전
Themify Ultra 8.0.1
관련 플러그인/테마
Themify Ultra
주제 태그
Compatibility

문제 개요

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

임시 해결 방법

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


  • …/wp-content/themes/themify-ultra/themify/themify-builder/classes/class-themify-builder-model.php 파일을 여세요.

  • 357번째 줄을 찾으세요.

  • 다음 코드를:
        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 '';
        }
            


  • 다음과 같이 변경하세요:
        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 '';
        }
            

알려진 모든 문제 →