Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save propertyhive/2eaab1f85aa52960e46adc4a9d0f480b to your computer and use it in GitHub Desktop.

Select an option

Save propertyhive/2eaab1f85aa52960e46adc4a9d0f480b to your computer and use it in GitHub Desktop.
// OLD SNIPPET:
add_filter( "houzez_property_feed_properties_due_import_expertagent", 'correct_department', 10, 2 );
function correct_department( $properties, $import_id )
{
foreach ( $properties as $i => $property )
{
if (
isset($property->numeric_price) &&
!empty((int)$property->numeric_price) &&
(int)$property->numeric_price < 10000
)
{
$properties[$i]->department = (string)$property->department . ' lettings';
}
}
return $properties;
}
// NEW SNIPPET TO REPLACE THE ABOVE IF NOT WANTING IT TO BE BASED ON PRICE ANY MORE
add_filter( "houzez_property_feed_properties_due_import_expertagent", 'correct_department_2', 10, 2 );
function correct_department_2( $properties, $import_id )
{
foreach ( $properties as $i => $property )
{
if ( isset($property->status4) )
{
$attributes = $property->status4->attributes();
if ( isset($attributes['name']) && strtolower((string)$attributes['name']) == 'to let' )
{
$properties[$i]->department = (string)$property->department . ' lettings';
}
}
}
return $properties;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment