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_kyero_query_args', 'export_sales_only', 10, 2 ); | |
| function export_sales_only( $args, $portal_id ) | |
| { | |
| if ( $portal_id != 0 ) { return; } // Only do this for the first portal feed with ID 0 | |
| $args['meta_query'][] = array( | |
| 'key' => '_department', | |
| 'value' => 'residential-sales', | |
| ); | |
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( 'elementor/query/oceanvillagequery', 'oceanvillage_elementor_query', 99 ); | |
| function oceanvillage_elementor_query( $query ) | |
| { | |
| $meta_query = $query->get('meta_query'); | |
| $meta_query[] = array( | |
| 'key' => '_address_concatenated', | |
| 'value' => 'Ocean Village', | |
| 'compare' => 'LIKE' | |
| ); |
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_agentsinsight_xml", 'import_custom_field', 10, 2 ); | |
| function import_custom_field($post_id, $property) | |
| { | |
| update_post_meta( $post_id, '_energy_rating', isset($property->current_energy_ratings->rating) ? (string)$property->current_energy_ratings->rating : '' ); | |
| } |
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_agentsinsight_xml", 'different_slug_format', 10, 2 ); | |
| function different_slug_format($post_id, $property) | |
| { | |
| // Display addrress/title | |
| $display_address = array(); | |
| if ( (string)$property->address1 != '' ) | |
| { | |
| $display_address[] = (string)$property->address1; | |
| } | |
| if ( (string)$property->address2 != '' ) |
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_template_assistant_custom_field_args_blakes_field', 'custom_additional_field_attributes', 10, 2); | |
| function custom_additional_field_attributes( $atts, $post_id ) | |
| { | |
| $atts['custom_attributes'] = array( | |
| 'readonly' => 'readonly' | |
| ); | |
| return $atts; | |
| } |
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_query_meta_query', 'custom_int_query', 10, 2 ); | |
| function custom_int_query( $meta_query, $ph_query ) | |
| { | |
| $new_meta_query = array(); | |
| foreach ( $meta_query as $key => $meta_query_element ) | |
| { | |
| if ( | |
| isset($meta_query_element) && isset($meta_query_element['key']) && $meta_query_element['key'] == '_int_m2' | |
| ) |
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_agentsinsight_xml_properties_due_import', 'filter_kato_properties_by_tag', 10, 1 ); | |
| function filter_kato_properties_by_tag( $properties ) | |
| { | |
| $allowed_tags = array( 'British Museum' ); // Define your allowed tags here | |
| $filtered_properties = array(); | |
| foreach ( $properties as $property ) | |
| { | |
| if ( isset($property->tags) ) | |
| { |
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_agentsinsight_xml_properties_due_import', 'filter_kato_properties_by_tag', 10, 1 ); | |
| function filter_kato_properties_by_tag( $properties ) { | |
| $allowed_tags = array( 'British Museum' ); // Define your allowed tags here | |
| $filtered_properties = array(); | |
| foreach ( $properties as $property ) { | |
| if ($property['tags'] == null || !is_array($property['tags'])) { | |
| continue; | |
| } |
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", 'set_kyero_statuses', 10, 3 ); | |
| function set_kyero_statuses( $post_id, $property, $import_id ) | |
| { | |
| wp_suspend_cache_invalidation( true ); | |
| wp_defer_term_counting( true ); | |
| wp_defer_comment_counting( true ); | |
| $department = 'residential-sales'; | |
| if ( isset($property->price_freq) && ( (string)$property->price_freq == 'week' || (string)$property->price_freq == 'month' ) ) | |
| { |
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('property_address', 'property_owners'); | |
| function property_owners() | |
| { | |
| global $property; | |
| if ( !isset($property->id) ) { | |
| return; | |
| } | |
| ob_start(); |