نظرة عامة على المشكلة
عند استخدام ودجت Image Carousel من Elementor مع WPML، لا تُعرض التسميات التوضيحية المترجمة للصور في الواجهة الأمامية، حتى عند ترجمة التسميات التوضيحية في مكتبة الوسائط وترجمة الصفحة.
حل بديل مؤقت
تم إصلاح هذه المشكلة في WPML Multilingual CMS 4.7.4. يحل التحديث المشكلة على موقعك، لذا لا تحتاج إلى هذا الحل البديل المؤقت إلا إذا لم تتمكن من التحديث بعد.
يُرجى التأكد من أخذ نسخة احتياطية كاملة لموقعك قبل المتابعة.
- افتح ملف functions.php الخاص بقالبك.
- أضف المقتطف التالي:
// WPML Workaround for compsupp-7726
add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7726_filter_imagecarousel_widget');
function wpml_compsupp7726_filter_imagecarousel_widget($element) {
if ( 'image-carousel' !== $element->get_name() ) {
return;
}
$settings = $element->get_settings();
if ( isset( $settings['carousel'] ) && is_array( $settings['carousel'] ) ) {
foreach ( $settings['carousel'] as $key => $value ) {
$post_type = get_post_type( $value['id'] );
if ( ! $post_type ) {
continue;
}
$value['id'] = apply_filters( 'wpml_object_id', $value['id'], $post_type, true );
unset($settings['carousel'][$key]['id']);
$settings['carousel'][$key]['id'] = $value['id'];
}
$element->set_settings( 'carousel', $settings['carousel'] );
}
}