WPML
Trạng thái
Đã được giải quyết bởi nhà phát triển
Loại
Lỗi
Plugin/giao diện liên quan
WP Event Manager
Thẻ chủ đề
Compatibility

Tổng quan về sự cố

Khi dịch các sự kiện được tạo bằng WP Event Manager và WPML, các trường Organizer và Venue không phải lúc nào cũng hiển thị bằng ngôn ngữ mặc định trên giao diện người dùng.

Giải pháp tạm thời

Vui lòng đảm bảo bạn có bản sao lưu đầy đủ cho trang web của mình trước khi tiếp tục.

Bạn sẽ cần thực hiện các thay đổi sau.


  1. Truy cập WPML → Cài đặt → Dịch trường tùy chỉnh

  2. Thiết lập các trường tùy chỉnh _event_organizer_ids và _event_venue_ids thành Sao chép.

  3. Sau đó, mở tệp /wp-content/plugins/wp-event-manager/wp-event-manager-template.php.

  4. Tìm dòng 1229.

  5. Thay đổi:
    foreach ($post->_event_organizer_ids as $key => $organizer_id) {

    Thành:

    foreach ($post->_event_organizer_ids as $key => $organizer_id) {
    
    	// WPML Workaround for compsupp-6662
    	if (class_exists('SitePress')) {
    		$organizer_id = apply_filters( 'wpml_object_id', $organizer_id, 'event_organizer', TRUE  );
    	}


  6. Tiếp theo, mở tệp /wp-content/plugins/wp-event-manager/wp-event-manager-functions.php.

  7. Tìm dòng 1903.

  8. Thay đổi:
    function get_event_organizer_ids( $post = null ) {
    	$post = get_post( $post );
    
    	if ( $post->post_type !== 'event_listing' )
    		return;
    
    	return !empty($post->_event_organizer_ids) ? $post->_event_organizer_ids : '';
    }

    Thành:

    function get_event_organizer_ids( $post = null ) {
    	$post = get_post( $post );
    
    	if ( $post->post_type !== 'event_listing' ) {
    		return;
    	}
    
    	// WPML Workaround for compsupp-6662
    	if ( class_exists('SitePress') && !empty($post->_event_organizer_ids) ) {
    		foreach ($post->_event_organizer_ids as $key => $organizer_id ) {
    			$result = $post->_event_organizer_ids;
    			$result[$key] = apply_filters( 'wpml_object_id', $organizer_id, 'event_organizer', TRUE  );
    		}
    
    		return $result;
    	}	
    
    	return !empty($post->_event_organizer_ids) ? $post->_event_organizer_ids : '';
    }

  9. Cuối cùng, trong cùng tệp đó, tìm dòng 1985.

  10. Thay đổi:
    function get_event_venue_ids( $post = null ) {
    	$post = get_post( $post );
    
    	if ( $post->post_type !== 'event_listing' )
    		return;
    
    	return !empty($post->_event_venue_ids) ? $post->_event_venue_ids : '';
    }

    Thành:

    function get_event_venue_ids( $post = null ) {
    	$post = get_post( $post );
    
    	if ( $post->post_type !== 'event_listing' )
    		return;
    
    	// WPML Workaround for compsupp-6662
    	if ( class_exists('SitePress') && !empty($post->_event_venue_ids) ) {
    		$result = apply_filters( 'wpml_object_id', $post->_event_venue_ids , 'event_listing', TRUE  );
    		return $result;
    	}	
    
    	return !empty($post->_event_venue_ids) ? $post->_event_venue_ids : '';
    }

Tất cả lỗi đã ghi nhận