Navigation überspringen

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' ];
    

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>