تخطي إلى المحتوى تخطي إلى الشريط الجانبي
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 voices.

آخر تحديث بواسطة ociohogar-home-designS قبل 6 أيام، 16 ساعة.

يساعده: Lauren.

الكاتب المشاركات
فبراير 2, 2026 في 7:19 م #17785085

ociohogar-home-designS

Hi,

The workaround you proposed for this support ticket:
https://wpml.org/forums/topic/issues-translating-a-site-with-wp-rentals-2/

works fine for a single apartment in WP Rentals. Before that code change you proposed, the reviews were visible only on the original language, they were not visible in the other languages.

However I have found that if I activate a second apartment on WP Rentals, all the same reviews for the "Stunning sea views..." apartment are also visible on the new apartment, instead of showing only reviews that are corresponding to the right apartment.

Basically the code changes that were done are not filtering by the right listing post-id.

Could you please help to fix that?

The code changes that were proposed by WPML team were:

diff --git a/wp-content/themes/wprentals/libs/reviews/reviews-functions.php b/wp-content/themes/wprentals/libs/reviews/reviews-functions.php
index d3d8195d..21ccd68b 100755
--- a/wp-content/themes/wprentals/libs/reviews/reviews-functions.php
+++ b/wp-content/themes/wprentals/libs/reviews/reviews-functions.php
@@ -12,6 +12,18 @@ if( !function_exists('wpestate_property_show_reviews')):
$cpaged = ( get_query_var( 'rp' ) != '' ) ? get_query_var( 'rp' ) : 1;
$reviews_per_page = 7;// set low for testing purposes

+ // WPML Workaround for compsupp-8268
+ if ( class_exists('Sitepress') ) {
+
+ $trid = apply_filters( 'wpml_element_trid', null, $postID, 'estate_property' );
+ $translations = apply_filters( 'wpml_get_element_translations', null, $trid, 'estate_property' );
+ // Create an array with the post_ids for all languages
+ $postID = array();
+ foreach ( $translations as $lang => $tr ) {
+ $postID[] = (int) $tr->element_id;
+ }
+ }
+
$args = array(
'post_type' => 'estate_review',
'post_parent' => 0,
@@ -21,11 +33,13 @@ if( !function_exists('wpestate_property_show_reviews')):
array(
'key' => 'attached_to',
'value' => $postID,
- 'compare' => '='
+ 'compare' => 'IN'
)
),
'paged' => intval( $cpaged ),
+ 'suppress_filters' => true,
);
+ // End WPML workaround

$comments_query = new WP_Query( $args );
$comments = $comments_query->posts;
@@ -802,4 +816,4 @@ if (!function_exists('wpestate_query_vars')) {

}

-add_filter('query_vars', 'wpestate_query_vars');
No newline at end of file
+add_filter('query_vars', 'wpestate_query_vars');

الموضوع ”[مغلق] Solution proposed for https://wpml.org/forums/topic/issues-translating-a-site-with-wp-rentals-2/ is …“ مغلق للردود الجديدة.