WPML
ステータス
開発者からの返答待ち
関連するプラグイン/テーマ
Event Tickets Plus

問題の概要

Event Tickets Plusプラグインを使用して新規イベントを作成し、チケットを追加すると、翻訳されたイベントページにはチケットセクションが表示されません。

回避策

続行する前に、サイトの完全なバックアップを作成してください。

  1. 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>
  2. 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;
    }
  3. イベントを作成し、それにチケットを追加します。
  4. イベントを翻訳します。
  5. 商品すべての商品に移動し、チケットを編集します。
  6. チケットに少し変更を加えて保存します。
  7. チケットを翻訳します。イベントがすでに存在する場合は、チケットを翻訳するにイベントを翻訳するだけでよいことに注意してください。両方がすでに翻訳されている場合は、元のチケットに少し変更を加えてから、翻訳を更新します。

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チームの公開サポートフォーラム、または非公開サポートチャネルからその旨をお伝えください。私たちも協力してこの問題の解決を推進できるよう努めます。

すべての既知の問題 →