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_wpresidence_property_synced", 'set_property_user', 10, 3 ); | |
| function set_property_user($property_id, $post_id, $synced) | |
| { | |
| // Import ID => WordPress User ID | |
| $import_to_user_map = array( | |
| '1000000' => 10, | |
| '1000001' => 11, | |
| '1000002' => 12, | |
| ); |
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_form_taxonomy_terms_args', 'custom_form_taxonomy_terms_args', 10, 2 ); | |
| function custom_form_taxonomy_terms_args( $args, $field ) { | |
| if ( $field['type'] == 'property_type' ) { | |
| $args['include'] = array( 1, 2, 3 ); // Replace with your desired term IDs from Property Hive -> Settings -> Custom Fields -> Residential Property Types | |
| } | |
| 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
| // for use when the embedded area isn't populated or doesn't work for some reason | |
| add_action( "propertyhive_property_imported_reapit_foundations_json", "assign_location_from_multiple_fields", 10, 2 ); | |
| function assign_location_from_multiple_fields( $post_id, $property ) { | |
| $location_set = false; | |
| $fields_to_check = array( 'line2', 'line3' ); | |
| foreach ( $fields_to_check as $field ) { |
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_street_json_properties_due_import", 'filter_street_low_profile_properties', 10, 2 ); | |
| function filter_street_low_profile_properties($properties, $import_id) | |
| { | |
| $filtered_properties = array(); | |
| foreach ($properties as $property) { | |
| $is_low_profile = false; | |
| if (isset($property['salesListing']['is_low_profile']) && $property['salesListing']['is_low_profile'] === true) { | |
| $is_low_profile = 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_shortcode( 'properties_with_fallback', 'ph_properties_with_fallback' ); | |
| function ph_properties_with_fallback( $atts ) { | |
| $atts = shortcode_atts( | |
| array( | |
| 'primary_atts' => '', | |
| 'fallback_atts' => '', | |
| 'fallback_message' => '', | |
| ), |
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( 'template_redirect', 'ph_redirect_off_market_properties' ); | |
| function ph_redirect_off_market_properties() { | |
| // Only run on single property posts | |
| if ( ! is_singular( 'property' ) ) { | |
| return; | |
| } | |
| // Allow admins to view off-market properties | |
| if ( current_user_can( 'administrator' ) ) { |
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_street_json", 'import_furnished_and_type', 10, 2 ); | |
| function import_furnished_and_type( $post_id, $property ) { | |
| //furnished | |
| if ( isset( $property['lettingsListing']['furnished'] ) && !empty( $property['lettingsListing']['furnished'] ) ) { | |
| $furnished = sanitize_text_field( $property['lettingsListing']['furnished'] ); | |
| $allowed_values = array( 'Furnished', 'Unfurnished', 'Part Furnished' ); | |
| if ( in_array( $furnished, $allowed_values ) ) { | |
| wp_set_object_terms( $post_id, $furnished, 'furnished' ); |
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_agency_pilot_api_request_body", 'include_completed_in_body' ); | |
| function include_completed_in_body($body) | |
| { | |
| $body['FilterOptions']['ActiveOnly'] = false; | |
| return $body; | |
| } | |
| add_filter( "propertyhive_agency_pilot_api_properties_due_import", 'filter_completed', 10, 3 ); | |
| function filter_completed($properties, $options, $token) | |
| { |
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 | |
| /** | |
| * The Template for displaying a single property. | |
| * | |
| * Override this template by copying it to yourtheme/propertyhive/single-property.php | |
| * | |
| * @author PropertyHive | |
| * @package PropertyHive/Templates | |
| * @version 1.0.0 | |
| */ |
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
| //adds a new option to the wp bulk options dropdown | |
| // Add a custom bulk action to the dropdown | |
| function add_bulk_delete_media_action($bulk_actions) { | |
| $bulk_actions['delete_attached_media'] = __('Delete Attached Media', 'text-domain'); | |
| return $bulk_actions; | |
| } | |
| add_filter('bulk_actions-edit-property', 'add_bulk_delete_media_action'); | |
| // Handle the custom bulk action |
NewerOlder