This user has no favorite topics.
Favorite Forum Topics
Forum Topics Created
Status |
Topic
|
Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
I’m using Premium Addons for Elementor (blog widget) and there’s a bug in catégory filters with t…
1
2
Started by: karimG-6
in: English Support
Problem: // WPML Workaround for compsupp-7625 add_action( 'elementor/frontend/widget/before_render', 'wpml_compsupp7625_modify_premium_blog_tax_filter', 10, 1 ); function wpml_compsupp7625_modify_premium_blog_tax_filter( $widget ) { // Check if this is the Premium Blog widget if ( 'premium-addon-blog' !== $widget->get_name() ) { return; } $settings = $widget->get_settings(); // Check if WPML is active if ( class_exists('Sitepress') ) { // Get the active languages from WPML $languages = apply_filters('wpml_active_languages', NULL, array('skip_missing' => 0)); $post_type = $settings['post_type_filter']; $filter_types = array('category', 'tag', 'author'); foreach ($filter_types as $filter_type) { $filter = ($filter_type === 'tag') ? 'post_tag' : $filter_type; $setting_key = "tax_{$filter}_{$post_type}_filter"; if (isset($settings[$setting_key]) && is_array($settings[$setting_key])) { $modified_filters = $settings[$setting_key]; foreach ($settings[$setting_key] as $filter_term_slug) { $term_object = get_term_by('slug', $filter_term_slug, $filter); if ($term_object) { $filter_term_id = $term_object->term_id; foreach ($languages as $language) { $translated_term_id = apply_filters('wpml_object_id', $filter_term_id, $filter, false, $language['language_code']); if ($translated_term_id) { $translated_term_object = get_term_by('id', $translated_term_id, $filter); if ($translated_term_object && !in_array($translated_term_object->slug, $modified_filters)) { $modified_filters[] = $translated_term_object->slug; } } } } } $settings[$setting_key] = $modified_filters; } } $widget->set_settings($settings); } } Please ensure to back up your site fully before implementing this code. If this solution does not resolve your issue or seems irrelevant due to updates or different configurations, we recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, please open a new support ticket at WPML support forum. |
|
2 | 16 | 10 months, 3 weeks ago |