Home›Support›English Support›[Resolved] I'm using Premium Addons for Elementor (blog widget) and there's a bug in catégory filters with t...
[Resolved] I'm using Premium Addons for Elementor (blog widget) and there's a bug in catégory filters with t...
This thread is resolved. Here is a description of the problem and solution.
Problem: You are using the Premium Addons for Elementor, specifically the blog widget with a category filter, and encountering issues where no articles are found in the translated blog widget or the category bar disappears when modifying the first label text. Solution: We identified this as a compatibility issue with Premium Addons for Elementor. Initially, we attempted to reproduce and debug the issue on a sandbox site. After confirming the problem persists, we provided a code snippet to be added to the functions.php file of your theme. This code adjusts the category filters based on the active languages in WPML, ensuring the correct translation and display of categories in different languages. Here is the code you need to implement:
// 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.
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Background of the issue:
I am using Premium Addons for Elementor (blog widget) and trying to have a translated blog widget with a category filter. The issue can be seen on this page: hidden link
The categories and their translations are well mapped.
Symptoms:
The current query has no posts. Please make sure you have published items matching your query.
Questions:
Why are no articles found in the translated blog widget?
Welcome to the WPML support forum. I will do my best to help you to resolve the issue.
We hope you have translated all the posts and pages into a secondary language. A couple of requests for tracking this.
1) Please let us know the exact steps to reproduce the issue on your site
2) Please fill the private details fields after a full site backup{mandatory}. I would like to access the admin area of your site for further checking. Refer to the following links for more details about our private information-sharing policies.
Thank you for the details and login information. Please upgrade to the latest version of Elementor, Elementor Pro, and Premium Addons for Elementor after a full site backup. Then make sure the issue exists or not.
If the problem remains, please allow me to create a test page on the site to check it.
Thank you for the updates. Please allow me to make a copy of your site using the Duplicator plugin (https://wordpress.org/plugins/duplicator/) for debugging the issue on my local server. So we can troubleshoot the bug without affecting your live site.
PA support said that it's a WPML issue. If it's not resolved today I have to change PA, abandon WPML, and change more then 20 pages, otherwise I will lose my job.
Thank you for the feedback. This looks like a compatibility issue with Premium Addons for Elementor. The possible workarounds are not helping in this case. So sorry about your tight situation.
Therefore I have created a test site in our Sandbox Server for further debugging of this bug. Reproducing the issues in a fresh/minimal installation will help us a lot in debugging and also we can escalate the ticket directly to our compatibility team to find a fix.
Please try the following steps and make sure the bug exists or is not on the sandbox site.
1) Click this URL to visit the Sandbox site backend - hidden link
2) Configure WPML like your live site and activate WPML add-ons
3) Install and activate Premium Addons for Elementor
5) Create a couple of posts in the original language and translate it
6) Create a page with filters and translate it
Thank you for the feedback. This looks like a compatibility issue with Premium Addons for Elementor. The possible workarounds are not helping in this case. So sorry about your tight situation.
Therefore I have created a test site in our Sandbox Server for further debugging of this bug. Reproducing the issues in a fresh/minimal installation will help us a lot in debugging and also we can escalate the ticket directly to our compatibility team to find a fix.
Please try the following steps and make sure the bug exists or is not on the sandbox site.
1) Click this URL to visit the Sandbox site backend - hidden link
2) Configure WPML like your live site and activate WPML add-ons
3) Install and activate Premium Addons for Elementor
5) Create a couple of posts in the original language and translate it
6) Create a page with filters and translate it
Thank you for the quick response and for replicating the bug in the sandbox site. The ticket is escalated to our compatibility team for further debugging. We will get back to you as soon as possible. Please wait.
Sorry for the late response. We were trying for an easy workaround to fix this bug. We are getting the expected results in the sandbox site after adding the following code in the functions.php file of the theme - hidden link
// 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 try it on your site after a full site backup {mandatory} and let us know your feedback.
--
Thanks!
Bigul
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.