Navigation überspringen

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

Eine Antwort hinterlassen

Bitte bleiben Sie beim Thema und verhalten Sie sich anderen gegenüber respektvoll. Wenn Sie Hilfe bei Problemen benötigen, die nicht mit diesem Beitrag zusammenhängen, nutzen Sie unser Support-Forum, um einen Chat zu starten oder ein Ticket einzureichen.

Sie können diese Tags verwenden:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>