Saltar navegación

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

Deje una respuesta

Por favor, mantente dentro del tema y sé respetuoso con los demás. Si necesitas ayuda con cuestiones no relacionadas con este post, utiliza nuestro Foro de soporte para iniciar un chat o enviar un ticket.

Puede utilizar estas etiquetas:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>