- الحالة
- في انتظار المطور
- الإضافة/القالب ذو الصلة
- Event Tickets Plus
نظرة عامة على المشكلة
عندما تستخدم إضافة Event Tickets Plus لإنشاء حدث جديد وإضافة تذاكر إليه، لا يظهر قسم التذاكر في صفحة الحدث المترجمة.
حل بديل مؤقت
قبل المتابعة، يُرجى أخذ نسخة احتياطية كاملة لموقعك:
- أضف المقتطف التالي إلى WPML → إعدادات → تكوين XML مخصص:
<wpml-config> <custom-fields> <custom-field action="copy">_ticket_end_date</custom-field> <custom-field action="copy">_ticket_start_date</custom-field> <custom-field action="copy">_tribe_ticket_capacity</custom-field> <custom-field action="copy">_tribe_ticket_show_description</custom-field> <custom-field action="copy">_tribe_ticket_version</custom-field> <custom-field action="copy">_tribe_tickets_ar_iac</custom-field> <custom-field action="copy">_tribe_tickets_meta</custom-field> <custom-field action="copy-once">_tribe_wooticket_for_event</custom-field> </custom-fields> </wpml-config> - أضف الكود التالي إلى ملف functions.php:
//WPML Workaround add_action( 'save_post', 'wpmldp_update_tribe_wooticket_for_event_meta', 999,3 ); function wpmldp_update_tribe_wooticket_for_event_meta( $post_id, $post, $update ) { // Only set for post_type = product if ( 'product' !== $post->post_type ) { return; } //Check if WPML and THe Events Calendar are enabled if (class_exists('SitePress')) { //Get the current ID on "_tribe_wooticket_for_event" meta $current_wooticket_id = get_post_meta($post_id, '_tribe_wooticket_for_event'); if ( $current_wooticket_id ) { //Get Post Language $wpml_post_language_details = apply_filters( 'wpml_post_language_details', NULL, $post_id ) ; $wpml_current_language = $wpml_post_language_details['language_code']; //Check if there is a translation for the $current_wooticket_id. If not, returns the original ID $translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'page', FALSE, $wpml_current_language); //Update post meta with the translated ID if ($translated_wooticket_id) { update_post_meta( $post_id, '_tribe_wooticket_for_event', $translated_wooticket_id ); } } } return; } - أنشئ الحدث، وأضف التذاكر إليه.
- ترجم الحدث.
- اذهب إلى المنتجات → جميع المنتجات وعدّل التذكرة.
- أجرِ تعديلاً بسيطاً على التذكرة واحفظ.
- ترجم التذكرة. ضع في اعتبارك أنه إذا كان الحدث موجوداً بالفعل، فستحتاج فقط إلى ترجمته قبل ترجمة التذكرة. إذا كان كلاهما مترجماً بالفعل، فأجرِ تعديلاً بسيطاً على التذكرة الأصلية، ثم حدّث الترجمة.
إذا كنت تستخدم إضافة The Events Calendar، فستحتاج إلى تغيير هذا السطر:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'page', FALSE, $wpml_current_language);إلى:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'tribe_events', FALSE, $wpml_current_language);
الخطوات التالية
لا تتوافق إضافة Event Tickets Plus مع WPML بشكل كامل بعد، لكننا نود العمل بشكل تعاوني مع فريق The Events Calendar لإنجاز ذلك. إذا كان توافق هذه الإضافة مع WPML مهماً بالنسبة لك، فيُرجى إبلاغ فريق The Events Calendar عبر منتدى الدعم العام الخاص بهم، أو قنوات الدعم الخاصة ويمكننا محاولة المضي قدماً في هذا الأمر معاً.