סקירת התקלה
בעת תרגום עמוד באמצעות WPML עם מודול Feature Content בערכת העיצוב Themify Ultra, טקסט ה־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 ''; }