- Status
- Aguardando o autor
- Plugin/tema relacionado
- Event Tickets Plus
Visão geral do problema
Quando você está usando o plugin Event Tickets Plus para criar um novo evento e adicionar ingressos a ele, a seção de ingressos não aparece na página traduzida do evento.
Solução alternativa
Por favor, antes de prosseguir, faça um backup completo do seu site:
- Adicione o seguinte trecho em WPML → Configurações → Configuração XML personalizada:
<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> - Adicione o seguinte código ao arquivo 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; } - Crie o evento e adicione ingressos a ele.
- Traduza o evento.
- Vá para Produtos → Todos os produtos e edite o ingresso.
- Faça uma pequena modificação no ingresso e salve.
- Traduza o ingresso. Lembre-se de que, se o evento já existir, você só precisa traduzi-lo antes de traduzir o ingresso. Se ambos já estiverem traduzidos, faça uma pequena modificação no ingresso original e, em seguida, atualize a tradução.
Se você estiver usando o plugin The Events Calendar, precisará alterar esta linha:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'page', FALSE, $wpml_current_language);Para:
$translated_wooticket_id = apply_filters( 'wpml_object_id', $current_wooticket_id[0], 'tribe_events', FALSE, $wpml_current_language);
Próximos passos
O Event Tickets Plus e o WPML ainda não são totalmente compatíveis, mas gostaríamos de trabalhar em colaboração com a equipe do The Events Calendar para finalizar isso. Se a compatibilidade deste plugin com o WPML for importante para você, informe a equipe do The Events Calendar por meio de seu fórum de suporte público ou canais de suporte privados e podemos tentar avançar com isso juntos.