Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Last active June 6, 2025 08:46
Show Gist options
  • Save propertyhive/e2c738087a3a370e37ac86a3bba14454 to your computer and use it in GitHub Desktop.
Save propertyhive/e2c738087a3a370e37ac86a3bba14454 to your computer and use it in GitHub Desktop.
add_action( "propertyhive_property_imported_inmobalia_xml", 'import_sizes', 10, 3 );
function import_sizes( $post_id, $property, $import_id )
{
if ( isset($property->mts_build) )
{
update_post_meta( $post_id, '_build_area', (string)$property->mts_build );
}
if ( isset($property->mts_plot) )
{
update_post_meta( $post_id, '_plot_area', (string)$property->mts_plot );
}
}
add_action( "propertyhive_houzez_property_synced", 'sync_sizes', 10, 2 );
function sync_sizes( $post_id, $synced )
{
$property = new PH_Property($post_id);
update_post_meta( $post_id, 'fave_property_size', ( ( $property->build_area != '' && $property->build_area != '0' ) ? $property->build_area : '' ) );
update_post_meta( $post_id, 'fave_property_size_prefix', ( ( $property->build_area != '' && $property->build_area != '0' ) ? 'Sq M' : '' ) );
update_post_meta( $post_id, 'fave_property_land', ( ( $property->plot_area != '' && $property->plot_area != '0' ) ? $property->plot_area : '' ) );
update_post_meta( $post_id, 'fave_property_land_postfix', ( ( $property->plot_area != '' && $property->plot_area != '0' ) ? 'Sq M' : '' ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment