Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created November 23, 2022 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save propertyhive/b978b1d1664bbcda592fc0789e8fbff4 to your computer and use it in GitHub Desktop.
Save propertyhive/b978b1d1664bbcda592fc0789e8fbff4 to your computer and use it in GitHub Desktop.
add_action( "propertyhive_property_imported_vebra_api_xml", 'set_alto_area', 10, 2 );
function set_alto_area( $post_id, $property )
{
update_post_meta( $post_id, '_area_max', '' );
if ( isset($property->area->max) && !empty((string)$property->area->max) )
{
update_post_meta( $post_id, '_area_max', (string)$property->area->max );
}
else
{
if ( isset($property->area->min) && !empty((string)$property->area->min) )
{
update_post_meta( $post_id, '_area_max', (string)$property->area->min );
}
}
}
add_action( "propertyhive_realhomes_property_synced", 'set_rh_area', 10, 3 );
function set_rh_area( $property_id, $post_id, $synced )
{
if ( $synced )
{
$property = new PH_Property($property_id);
update_post_meta( $post_id, 'REAL_HOMES_property_size', $property->_area_max );
update_post_meta( $post_id, 'REAL_HOMES_property_size_postfix', 'sq ft' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment