Created
July 17, 2025 16:11
-
-
Save propertyhive/fd5ee85b08d9e5f50aaed2b288e8f5d8 to your computer and use it in GitHub Desktop.
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_action( "propertyhive_property_imported_reapit_foundations_json", 'situation_as_features', 10, 2 ); | |
| function situation_as_features($post_id, $property) | |
| { | |
| if ( isset($property['situation']) && !empty($property['situation']) ) | |
| { | |
| // Do existing feature functionality | |
| $features = array(); | |
| if ( isset($property['specialFeatures']) && !empty($property['specialFeatures']) ) | |
| { | |
| foreach ( $property['specialFeatures'] as $feature ) | |
| { | |
| $features[] = trim($feature); | |
| } | |
| } | |
| foreach ( $property['situation'] as $situation ) | |
| { | |
| $features[] = trim($situation); | |
| } | |
| update_post_meta( $post_id, '_features', count( $features ) ); | |
| $i = 0; | |
| foreach ( $features as $feature ) | |
| { | |
| update_post_meta( $post_id, '_feature_' . $i, $feature ); | |
| ++$i; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment