Skip to content Skip to sidebar

Resolved by author

Topic Tags: Compatibility

Overview of the issue

When using the Houzez theme, you might experience the following issue: translated properties do not retain their agent assignment, causing the translated agent profiles to display zero properties. This occurs because the agent field (fave_agents) does not correctly link to the translated agent post.

Workaround

Please, make sure of having a full site backup of your site before proceeding.

1. Set the translation preference

  • Go to “WPML > Settings > Custom fields translation”
  • Set the translation preference of the custom field fave_agents to COPY

2. Adjust agent ID handling in theme functions

  • Open the …/wp-content/themes/houzez/framework/functions/property_functions.php file.
  • Look for line 3663 (houzez_get_property_agent function).
  • Replace:
    $agent_id = intval( $agent );
            
  • With:
    $agent_id = intval( $agent );
    // WPML Workaround for compsupp-7949 
    $agent_id = apply_filters( 'wpml_object_id', $agent_id, 'houzez_agent', TRUE ); 
            
  • Look for line 3738 (houzez20_get_property_agent function).
  • Replace:
    $agent_id = intval( $agent_id );
            
  • With:
    $agent_id = intval( $agent_id );
    // WPML Workaround for compsupp-7949 
    $agent_id = apply_filters( 'wpml_object_id', $agent_id, 'houzez_agent', TRUE ); 
            

3. Ensure agent profile lists the correct properties

  • Open the …/wp-content/themes/houzez/framework/classes/Houzez_Query.php file.
  • Look for line 718 (loop_agent_properties function).
  • Replace:
    $agent_id = get_the_ID();
            
  • With:
    $agent_id = get_the_ID();
    // WPML Workaround for compsupp-7949 
    $default_lang = apply_filters('wpml_default_language', NULL );  
    $agent_id = apply_filters( 'wpml_object_id', $agent_id, 'houzez_agent', TRUE,  $default_lang );