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( 'houzez_property_feed_update_postarr', 'retain_existing_data', 10, 4 ); | |
| function retain_existing_data( $my_post, $property, $import_id, $post_id ) { | |
| // Get the existing post object | |
| $existing_post = get_post( $post_id ); | |
| if ( $existing_post ) { | |
| // Preserve existing values | |
| $my_post['post_title'] = $existing_post->post_title; | |
| $my_post['post_excerpt'] = $existing_post->post_excerpt; | |
| $my_post['post_content'] = $existing_post->post_content; |
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( "houzez_property_feed_properties_due_import_kyero", 'new_build_only', 10, 2 ); | |
| add_filter( "houzez_property_feed_properties_due_import_xml", 'new_build_only', 10, 2 ); | |
| function new_build_only( $properties, $import_id ) | |
| { | |
| $new_properties = array(); | |
| foreach ( $properties as $property ) | |
| { | |
| if (isset($property->new_build) && (string)$property->new_build == '1') | |
| { |
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( 'wp_mail', 'stop_property_enquiry_email' ); | |
| function stop_property_enquiry_email( $args ) { | |
| if ( isset( $args['subject'] ) && strpos( $args['subject'], 'Property Enquiry' ) !== false ) { | |
| // Return false to completely cancel the email. | |
| return false; | |
| } | |
| return $args; | |
| } |
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( "houzez_property_feed_property_imported_property_finder", 'fix_duplicate_community', 10, 3 ); | |
| function fix_duplicate_community($post_id, $property, $import_id) | |
| { | |
| if ( | |
| isset($property->community) && | |
| isset($property->sub_community) && | |
| (string)$property->community == (string)$property->sub_community | |
| ) | |
| { | |
| $address_parts = array(); |
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_property_import_stop_if_no_properties', 'disable_import_failsafe', 10, 2 ); | |
| function disable_import_failsafe( $disable, $import_id ) | |
| { | |
| return false; | |
| } |
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
| // Validate before insert/update for the 'property' post type | |
| add_filter('wp_insert_post_data', function ($data, $postarr) { | |
| if (($data['post_type'] ?? '') !== 'property') { | |
| return $data; | |
| } | |
| // Try to read from POST (classic) or meta_input (REST/Gutenberg) | |
| $value = isset($_POST['_reference_number']) | |
| ? trim(wp_unslash($_POST['_reference_number'])) | |
| : ''; |
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_property_import_remove_properties_in_php', 'remove_in_php'); | |
| function remove_in_php($in_php) | |
| { | |
| return true; | |
| } |
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_property_enquiry_property_output', 'customise_property_output_in_enquiry', 10, 2 ); | |
| function customise_property_output_in_enquiry( $output, $property_id ) | |
| { | |
| $property = new PH_Property((int)$property_id); | |
| $office_name = $property->office_name; | |
| return 'Office: ' . $office_name . '\n' . $output; | |
| } |
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
| /* Get parking */ | |
| add_action( "propertyhive_property_imported_jupix_xml", 'assign_parking_taxonomy', 10, 2 ); | |
| function assign_parking_taxonomy($post_id, $property) | |
| { | |
| wp_suspend_cache_invalidation( true ); | |
| wp_defer_term_counting( true ); | |
| wp_defer_comment_counting( true ); | |
| $parking_types = array(); |
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_kyero_xml', 'use_nl_description_and_custom_title', 10, 2 ); | |
| function use_nl_description_and_custom_title( $post_id, $property ) { | |
| if ( $property->type->en ) | |
| { | |
| $property_type = (string)$property->type->en; | |
| } | |
| else | |
| { | |
| $property_type = (string)$property->type; |