Skip Navigation

Waiting for author

Topic Tags: Compatibility

Overview of the issue

When translating events created with WP Event Manager and WPML, Organizer and Venue fields do not always display in the default language on the front-end.

Workaround

Please be sure to have a full backup of your site before proceeding.

You will need to make the following changes.

  1. Go to WPMLSettingsCustom fields translation
  2. Set the _event_organizer_ids and _event_venue_ids custom fields to Copy.
  3. Then, open the /wp-content/plugins/wp-event-manager/wp-event-manager-template.php file.
  4. Look for line 1229.
  5. Change:
    foreach ($post->_event_organizer_ids as $key => $organizer_id) {
    

    To:

    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. Next, open the /wp-content/plugins/wp-event-manager/wp-event-manager-functions.php file.
  7. Look for line 1903.
  8. Change:
    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 : '';
    }
    

    To:

    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. Finally, in the same file, look for line 1985.
  10. Change:
    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 : '';
    }
    

    To:

    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 : '';
    }
    

Leave a Reply

Please stay on topic and be respectful to others. If you need help with issues not related to this post, use our Support Forum to start a chat or submit a ticket.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>