This thread is resolved. Here is a description of the problem and solution.
Problem:
FacetWP - translated checkbox labels are not rendered with shortcodes.
Steps to replicate the issue
The ACF phase
1. Create a field group and add a checkbox field to it.
2. In the Choices field, add at least one choice; for example like this boy : Boy.
3. Save the field group.
The WordPress phase
1. Create a post and select the checkbox's choices and publish the post.
The FacetWP phase
1. Go to Settings -> FacetWP.
2. Add a new Facet: Ensure to select Facet type = Checkbox and Data source = [Field group name] Field name.
3. Save and copy the shortcode.
The Elementor phase
1. Edit the post with Elementor.
2. Add a Shortcode element and insert the Facet shortcode.
3. Add a `Posts` element. And under the FacetWP section `Enable FacetWP`.
4. Save the changes.
The WPML phase
1. Translate the post with the Advanced Translation Editor.
2. Add translation to the checkbox labels, and complete the translation.
3. Check the translated post on the front end and see that the checkbox labels are not showing the translation.
A workaround solution:
1. Take a backup of your site in case something goes wrong.
2. Add the following function to the functions.php file of your theme and save the changes.
// WPML Workaround for compsupp-6751 function wpml_compsupp6751_translate_facet_display_value( $label, $args ) { if ( class_exists('Sitepress') ) { $wpml_default_lang = apply_filters('wpml_default_language', NULL ); $wpml_current_lang = apply_filters( 'wpml_current_language', NULL ); if ($wpml_default_lang == $wpml_current_lang ) { do_action( 'wpml_register_single_string', 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10), $label ); } // Apply the translation to the string $label = apply_filters('wpml_translate_single_string', $label , 'FacetWP', 'Facet Display Value : '.substr($label, 0, 10) ); } return $label; } add_filter( 'facetwp_facet_display_value', 'wpml_compsupp6751_translate_facet_display_value', 10, 2 );
3. On the front end, visit the page with the ACF fields in the original language. This will register the strings into Strings Translation.
4. Go to WPML -> Strings Translation and filter to show the FacetWP domain. Under it, you will find the strings with the name "Facet Display Value : *name". Those will be the label of the checkbox strings. Translate them into the other language.
**** Important! Please make a full site backup (files and DB) before you proceed with those steps****
Our compatibility team has contacted the FacedWP plugin developers, and we are trying to cooperate with them to solve this issue.
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.
This topic contains 17 replies, has 2 voices.
Last updated by 1 year, 6 months ago.
Assisted by: Itamar.