Skip to content

Instantly share code, notes, and snippets.

@g-maclean
Created October 1, 2025 06:07
Show Gist options
  • Save g-maclean/15c1c7c24a000a7f5e2d60cb69791c39 to your computer and use it in GitHub Desktop.
Save g-maclean/15c1c7c24a000a7f5e2d60cb69791c39 to your computer and use it in GitHub Desktop.
PropertyHive - Agent Insight - abbreviated floors / floorunit
add_filter( 'propertyhive_import_agentsinsight_units_description_table_data_columns', 'custom_data_columns' );
function custom_data_columns( $columns )
{
if ( isset($columns['name']) )
{
// Map of codes to labels
$floor_map = array(
'lg' => 'Lower Ground',
'g' => 'Ground',
'm' => 'Mezzanine',
'ug' => 'Upper Ground',
'b' => 'Building'
);
// Loop through the map and replace only at the start of the name
foreach ( $floor_map as $code => $label ) {
if ( substr($columns['name'], 0, strlen($code) + 1) === $code . ' ' ) {
$columns['name'] = $label . ' ' . substr($columns['name'], strlen($code) + 1);
break;
}
}
}
return $columns;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment