WPML
상태
미해결
관련 플러그인/테마
Unlimited Elements for Elementor
주제 태그
Compatibility

문제 개요

Unlimited Elements for Elementor 플러그인의 Post Grid 위젯을 사용할 때, 위젯이 번역된 페이지 버전에서 번역된 글을 가져오지 못합니다.

임시 해결 방법

진행하기 전에 전체 사이트 백업을 완료했는지 확인하세요.


  • 테마의 functions.php 파일을 여세요.

  • 다음 코드를 추가하세요:
    // WPML Workaround for compsupp-7445
    add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7445_filter_ucaddon_post_grid');
     
    function wpml_compsupp7445_filter_ucaddon_post_grid($element) {
        if ( 'ucaddon_post_grid' !== $element->get_name() ) {
            return;
        }
     
        $settings = $element->get_settings();
     
        if ( isset( $settings['post_list_manual_select_post_ids'] ) && is_array( $settings['post_list_manual_select_post_ids'] ) ) {
            foreach ( $settings['post_list_manual_select_post_ids'] as $key => $id ) {      
     
                $post_type = get_post_type( $id );
     
                if ( ! $post_type ) {
                    continue;
                }
     
                $id = apply_filters( 'wpml_object_id', $id, $post_type, false );
     
                unset($settings['post_list_manual_select_post_ids'][$key]);
                $settings['post_list_manual_select_post_ids'][] = $id;
            }
     
            $element->set_settings( 'post_list_manual_select_post_ids', $settings['post_list_manual_select_post_ids'] );
        }
    	
        if (isset($settings['post_list_manual_post_ids_dynamic'])) {
            // Check if the IDs are in a string and convert them to an array
            if (is_string($settings['post_list_manual_post_ids_dynamic'])) {
                $settings['post_list_manual_post_ids_dynamic'] = explode(',', $settings['post_list_manual_post_ids_dynamic']);
            }
    
            // Proceed only if it's an array
            if (is_array($settings['post_list_manual_post_ids_dynamic'])) {
                foreach ($settings['post_list_manual_post_ids_dynamic'] as $key => $id) {
                    $post_type = get_post_type($id);
                    if (!$post_type) {
                        continue;
                    }
                    $translated_id = apply_filters('wpml_object_id', $id, $post_type, false);
                    $settings['post_list_manual_post_ids_dynamic'][$key] = $translated_id;
                }
                $element->set_settings('post_list_manual_post_ids_dynamic', $settings['post_list_manual_post_ids_dynamic']);
            }
        }	
    }

알려진 모든 문제 →