Background of the issue:
I recently had contact with Kor - one of your supporters. However, I have no email chain and all was online, first via chat. I also can not locate the support thread. I had a problem with an Unlimited Elements widget - Kor did some faultfinding and then sent the issue to second tier support and came back with some code to add to our functions.php folder. It works and now translates and appears in the secondary language instead of being overwritten on the next ATE save. This is the code supplied by Kor:
// WPML Workaround for compsupp-7445
add_filter( 'elementor/frontend/before_render', 'wpml_compsupp7445_filter_ucaddon_post_grid');
function wpml_compsupp7445_filter_ucaddon_post_grid($element) {
if ( 'ucaddon_post_grid' !== $element->get_name() ) {
return;
}
$settings = $element->get_settings();
if ( isset( $settings['post_list_manual_select_post_ids'] ) && is_array( $settings['post_list_manual_select_post_ids'] ) ) {
foreach ( $settings['post_list_manual_select_post_ids'] as $key => $id ) {
if (isset($settings['post_list_manual_post_ids_dynamic'])) {
// Check if the IDs are in a string and convert them to an array
if (is_string($settings['post_list_manual_post_ids_dynamic'])) {
$settings['post_list_manual_post_ids_dynamic'] = explode(',', $settings['post_list_manual_post_ids_dynamic']);
}
// Proceed only if it's an array
if (is_array($settings['post_list_manual_post_ids_dynamic'])) {
foreach ($settings['post_list_manual_post_ids_dynamic'] as $key => $id) {
$post_type = get_post_type($id);
if (!$post_type) {
continue;
}
$translated_id = apply_filters('wpml_object_id', $id, $post_type, true);
$settings['post_list_manual_post_ids_dynamic'][$key] = $translated_id;
}
$element->set_settings('post_list_manual_post_ids_dynamic', $settings['post_list_manual_post_ids_dynamic']);
}
}
}
Symptoms:
One part of the Unlimited Elements widget is not being translated - it appears in English (the primary language) for all translated languages.
In the Post Grid Widget, this part is called the 'Intro'.
Questions:
if the change/correction to the code could be made to also display this filed in the translated language then all will be working perfectly 🙂
If Kor is available, maybe it would be helpful as he is recently familiar with the issue.
The topic ‘[關閉] Unlimited Elements Widget not translating correctly’ is closed to new replies.
管理 Cookie 同意
我们使用 cookies 来优化我们的网站和服务。 您的同意允许我们处理浏览行为等数据。 不同意可能会影响某些功能。
功能性
始终启用
为了我们的网站正常运行和通信所需的信息。
首选项
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.