Resolved by author
Overview of the issue
When using the Houzez theme with WPML, you might experience an issue where agent statistics (e.g., stats, reviews, listings) are not displayed on translated agent pages.
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open the …/wp-content/themes/houzez/template-parts/realtors/agent/single-agent-v1.php file.
- Look for line 70.
- Replace:
if( houzez_option('agent_stats', 0) != 0 ) { $agent_listing_ids = Houzez_Query::get_agent_properties_ids_by_agent_id(get_the_ID()); } - With:
if( houzez_option('agent_stats', 0) != 0 ) { $default_lang_agent_id = apply_filters( 'wpml_object_id', get_the_ID(), 'houzez_agent', false, wpml_get_default_language() ); $agent_listing_ids = Houzez_Query::get_agent_properties_ids_by_agent_id($default_lang_agent_id);} - Then open the …/wp-content/themes/houzez/framework/functions/stats.php file.
- Replace:
$count = houzez_realtor_stats($taxonomy_name, $meta_key, get_the_ID(), $slug); - With:
$default_lang_agent_id = apply_filters( 'wpml_object_id', get_the_ID(), 'houzez_agent', false, wpml_get_default_language() ); $count = houzez_realtor_stats($taxonomy_name, $meta_key, $default_lang_agent_id, $slug);