- Trạng thái
- Đang chờ nhà phát triển
- Plugin/giao diện liên quan
- Event Tickets Plus
Tổng quan về lỗi
Khi bạn sử dụng plugin Event Tickets Plus để tạo một sự kiện mới và thêm vé vào đó, phần vé không xuất hiện trên trang sự kiện đã dịch.
Giải pháp tạm thời
Vui lòng tạo bản sao lưu toàn bộ trang web của bạn trước khi tiếp tục:
- Thêm đoạn mã sau vào WPML → Cài đặt → Cấu hình XML tùy chỉnh:
<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> - Thêm mã sau vào tệp 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; } - Tạo sự kiện và thêm vé vào sự kiện đó.
- Dịch sự kiện.
- Đi tới Sản phẩm → Tất cả sản phẩm và chỉnh sửa vé.
- Thực hiện một sửa đổi nhỏ trên vé và lưu.
- Dịch vé. Hãy nhớ rằng nếu sự kiện đã tồn tại, bạn chỉ cần dịch nó trước khi dịch vé. Nếu cả hai đã được dịch, hãy thực hiện một sửa đổi nhỏ trên vé gốc, sau đó cập nhật bản dịch.
Nếu bạn đang sử dụng plugin The Events Calendar, bạn sẽ cần thay đổi dòng này:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'page', FALSE, $wpml_current_language);Thành:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'tribe_events', FALSE, $wpml_current_language);
Các bước tiếp theo
Event Tickets Plus và WPML chưa hoàn toàn tương thích, nhưng chúng tôi muốn hợp tác với nhóm The Events Calendar để hoàn thiện điều này. Nếu khả năng tương thích của plugin này với WPML quan trọng đối với bạn, vui lòng cho nhóm The Events Calendar biết thông qua diễn đàn hỗ trợ công khai hoặc các kênh hỗ trợ riêng tư của họ và chúng ta có thể cùng nhau cố gắng thúc đẩy quá trình này.