탐색 건너뛰기

Open

Topic Tags: Compatibility

Overview of the issue

When using Ultimate Addons for Elementor with WPML, the Post Grid Filter does not display translated category terms in secondary languages. Categories appear only in the default language.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open …/wp-content/plugins/ultimate-elementor/modules/posts/template-blocks/skin-style.php file.
  • Look for line 1088.
  • Replace:
    $filter_type = $settings[ $filter_by . '_' . $post_type . '_filter_rule' ];
    
    $filters = $settings[ 'tax_' . $filter_by . '_' . $post_type . '_filter' ];
    
  • With:
    $filter_type = $settings[ $filter_by . '_' . $post_type . '_filter_rule' ];
    
    // WPML Workaround for compsupp-7728
    if (class_exists('Sitepress')) {
    	$original_terms = $settings[ 'tax_' . $filter_by  . '_' . $post_type . '_filter' ];
    	$translated_terms = [];
    
    	foreach ($original_terms as $term_slug) {
    		$term_obj = get_term_by('slug', $term_slug, $filter_by );
    		
    		if ($term_obj) {
    			$translated_term_id = apply_filters('wpml_object_id', $term_obj->term_id, $filter_by , true);
    			$translated_term = get_term($translated_term_id, $filter_by );
    			if ($translated_term && !is_wp_error($translated_term)) {
    				$translated_terms[] = $translated_term->slug;
    			}
    		}
    	}
    
    	$settings[ 'tax_' . $filter_by  . '_' . $post_type . '_filter' ] = $translated_terms;			
    }
    
    $filters = $settings[ 'tax_' . $filter_by . '_' . $post_type . '_filter' ];
    

답장을 남겨주세요

주제를 유지하고 다른 사람을 존중하십시오. 이 게시물과 관련 없는 문제에 대한 도움이 필요한 경우 지원 포럼을 사용하여 채팅을 시작하거나 티켓을 제출하십시오.

다음 태그를 사용할 수 있습니다.
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>