Created
October 1, 2025 06:07
-
-
Save g-maclean/15c1c7c24a000a7f5e2d60cb69791c39 to your computer and use it in GitHub Desktop.
PropertyHive - Agent Insight - abbreviated floors / floorunit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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