ナビゲーションをスキップする

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>