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_agentos_json", "set_new_home_flag", 10, 2 ); | |
| function set_new_home_flag( $post_id, $property ) | |
| { | |
| if ( isset($property['IsNewHome']) && $property['IsNewHome'] === true ) | |
| { | |
| wp_suspend_cache_invalidation( true ); | |
| wp_defer_term_counting( true ); | |
| wp_defer_comment_counting( true ); | |
| wp_set_post_terms( $post_id, 123, 'marketing_flag' ); // Set 123 to term ID of 'New Home' flag set in 'Property hive > Settings > Cutom Fields > Marketing Flags |
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_xml", 'exclude_lease', 10, 2 ); | |
| function exclude_lease( $properties, $import_id ) | |
| { | |
| $new_properties = array(); | |
| foreach ( $properties as $property ) | |
| { | |
| if ( isset($property->Categories) && (string)$property->Categories === 'Lease' ) | |
| { | |
| // ignore |
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
| <?php | |
| // Place where you want this new section output: | |
| if ( isset($_GET['address_keyword']) && !empty($_GET['address_keyword']) ) | |
| { | |
| $address_keyword = sanitize_text_field($_GET['address_keyword']); | |
| $radius = 10; | |
| if ( isset($_GET['radius']) && !empty($_GET['radius']) ) | |
| { | |
| $radius = (int)$_GET['radius'] + 10; // add 10 miles to the radius already being searched |
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( 'pre_get_posts', 'custom_order_dd_properties_by_availability', 10, 2 ); | |
| function custom_order_dd_properties_by_availability($query) | |
| { | |
| if ( is_admin() ) | |
| { | |
| return; | |
| } | |
| $post_type = $query->get('post_type'); | |
| if ( !is_array($post_type) ) { $post_type = array($post_type); } |
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_reaxml", 'remove_commas_from_price', 10, 2 ); | |
| function remove_commas_from_price( $properties, $import_id ) | |
| { | |
| foreach ( $properties as $property ) | |
| { | |
| if ( isset($property->priceView) ) | |
| { | |
| $property->priceView = str_replace(",", "", (string)$property->priceView); | |
| } | |
| } |
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_reaxml", 'lowercase_suburb', 10, 2 ); | |
| function lowercase_suburb( $properties, $import_id ) | |
| { | |
| foreach ( $properties as $property ) | |
| { | |
| if ( isset($property->address->suburb) ) | |
| { | |
| $property->address->suburb = ucwords(strtolower((string)$property->address->suburb)); | |
| } | |
| } |
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_import_queued_media_imported', 'pause_between_media_imports', 10, 2 ); | |
| function pause_between_media_imports($property_id, $media_type) | |
| { | |
| sleep(5); // pause for 5 seconds between importing media for each property to try and get around 'Too Many Requests' issue. | |
| } |
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_demo_data_num_items', 'increase_demo_data_items' ); | |
| function increase_demo_data_items($num) | |
| { | |
| return 20; | |
| } |
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_auto_create_new_features', 'dont_auto_create_features' ); | |
| function dont_auto_create_features($auto_create) | |
| { | |
| 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
| add_filter( 'propertyhive_reapit_foundations_json_properties_requests', 'remove_sales_from_foundations_requests' ); | |
| function remove_sales_from_foundations_requests( $requests ) | |
| { | |
| unset($requests['sales']); | |
| return $requests; | |
| } |