Skip navigation
Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 10:00 8:00 – 10:00 8:00 – 13:00 8:00 – 13:00 9:00 – 13:00 -
- 11:00 – 17:00 11:00 – 17:00 14:00 – 17:00 13:00 – 17:00 13:00 – 18:00 -

Часовой пояс сторонника: America/New_York (GMT-05:00)

Эта тема содержит 0 ответов, имеет 1 голос.

Последнее обновление: justinK-16 4 месяца, 1 неделя назад.

При содействии: Lauren.

Автор Записи
5 июля, 2024 на 5:05 пп #15899545

justinK-16

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 ) {

$post_type = get_post_type( $id );

if ( ! $post_type ) {
continue;
}

$id = apply_filters( 'wpml_object_id', $id, $post_type, true );

unset($settings['post_list_manual_select_post_ids'][$key]);
$settings['post_list_manual_select_post_ids'][] = $id;
}

$element->set_settings( 'post_list_manual_select_post_ids', $settings['post_list_manual_select_post_ids'] );
}

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.

Тема '[Закрытые] Unlimited Elements Widget not translating correctly' закрыта для новых ответов.