דלג על ניווט

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:
    1
    foreach ($post->_event_organizer_ids as $key => $organizer_id) {

    To:

    1
    2
    3
    4
    5
    6
    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:
    1
    2
    3
    4
    5
    6
    7
    8
    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:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    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:
    1
    2
    3
    4
    5
    6
    7
    8
    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:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    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 : '';
    }

השאר מענה

אנא הישארו בנושא והיו מכבדים לאחרים. אם אתה צריך עזרה בבעיות שאינן קשורות לפוסט הזה, השתמש בפורום התמיכה שלנו כדי להתחיל צ'אט או לשלוח כרטיס.

תוכל להשתמש בתגים הבאים:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>