This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing issues where changes in the image order in a property's media gallery are not synchronizing across translations in different languages, this might be due to a compatibility issue between WPML and the Houzez theme.
Solution:
We recommend taking the following steps to address this issue:
1. Ensure you have a full backup of your site before proceeding.
2. Add the following code to your theme’s functions.php file:
// WPML - Workaround for compsupp-8361
add_action( 'save_post_property', function( $post_id ) {
// check if the property has translations
$trid = apply_filters( 'wpml_element_trid', null, $post_id, 'post_property' );
if ( ! $trid ) {
return;
}
// Get the translations
$translations = apply_filters( 'wpml_get_element_translations', null, $trid, 'post_property' );
// Get the gallery images
$fave_prop_images = get_post_meta( $post_id, 'fave_property_images', false );
foreach ( (array) $translations as $lang => $translation ) {
// delete the gallery
delete_post_meta( $translation->element_id, 'fave_property_images' );
foreach ( $fave_prop_images as $image_id ) {
// translate the image if needed
$image_id = apply_filters( 'wpml_object_id', $image_id, 'attachment', true, $lang );
// Re-add the image to the gallery
add_post_meta( $translation->element_id, 'fave_property_images', $image_id );
}
}
}, 1000 );
3. Update the properties once to reflect the changes.
Please note that this solution might become outdated or may not apply to your specific case. If this solution does not resolve your issue, we highly 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 further assistance is needed, 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.
This topic contains 19 replies, has 0 voices.
Last updated by 1 week, 1 day ago.
Assisted by: Shekhar Bhandari.