This file contains 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_radial_search_ignore_address', 'ignore_address'); | |
function ignore_address($ignore) | |
{ | |
return true; | |
} |
This file contains 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_sturents_property_imported", 'set_status_on_sturents', 10, 2 ); | |
function set_status_on_sturents( $post_id, $property ) | |
{ | |
wp_suspend_cache_invalidation( true ); | |
wp_defer_term_counting( true ); | |
wp_defer_comment_counting( true ); | |
wp_set_post_terms( $post_id, 5, 'availability' ); // Change 5 accordingly to new 'For Sale' status | |
wp_suspend_cache_invalidation( false ); |
This file contains 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_rex_json", 'correct_commercial_availabilities', 10, 2 ); | |
function correct_commercial_availabilities($post_id, $property) | |
{ | |
$department = get_post_meta( $post_id, '_department', TRUE ); | |
$to_rent = get_post_meta( $post_id, '_to_rent', TRUE ); | |
if ( $department == 'commercial' && $to_rent == 'yes' ) | |
{ | |
wp_suspend_cache_invalidation( true ); | |
wp_defer_term_counting( true ); |
This file contains 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', 'add_rex_property_id_to_enquiries', 10, 2 ); | |
function add_rex_property_id_to_enquiries( $output, $property_id ) | |
{ | |
$property = new PH_Property($property_id); | |
$output = $property->get_formatted_full_address() . "\n" . | |
$property->get_formatted_price() . "\n" . | |
get_permalink( (int)$property_id ) . "\n" . | |
'Property ID: ' . $property->imported_id; | |
This file contains 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_gnomen_xml", 'import_new_home_custom_field', 10, 2 ); | |
function import_new_home_custom_field($post_id, $property) | |
{ | |
if ( isset($property->property_no) && strtolower((string)$property->new_home, 'preown') !== false ) | |
{ | |
update_post_meta( $post_id, '_new_home', 'Pre-owned Home' ); | |
} | |
else | |
{ | |
update_post_meta( $post_id, '_new_home', 'New Home' ); |
This file contains 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", 'sync_material_info_stuff_to_wpr', 10, 3 ); | |
function sync_material_info_stuff_to_wpr( $ph_post_id, $wpr_post_id, $synced ) | |
{ | |
if ( $synced === true ) | |
{ | |
$property = new PH_Property($ph_post_id); | |
// Utilities and Accessibility | |
$utility_types = array( | |
'electricity', |
This file contains 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_resales_online_api", 'import_orientation', 10, 4 ); | |
function import_orientation( $post_id, $property, $import_id, $instance_id ) | |
{ | |
if (isset($property['PropertyFeatures']['Category'])) { | |
foreach ($property['PropertyFeatures']['Category'] as $feature) { | |
if (isset($feature['Type']) && $feature['Type'] === 'Orientation') { | |
if (!empty($feature['Value'][0])) { | |
update_post_meta($post_id, 'fave_orientation', $feature['Value'][0]); // assuming the meta key 'fave_orientation' here. Would need login access to confirm this if it doesn't work | |
} | |
break; |
This file contains 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_vebra_api_xml", 'import_energy_stuff', 10, 2 ); | |
function import_energy_stuff( $post_id, $property ) | |
{ | |
if ( | |
isset($property->hip->energy_performance->energy_efficiency->current) && | |
(string)$property->hip->energy_performance->energy_efficiency->current != '' && | |
(string)$property->hip->energy_performance->energy_efficiency->current != '0' | |
) | |
{ | |
update_post_meta( $post_id, '_energy_efficiency_current', (string)$property->hip->energy_performance->energy_efficiency->current ); |
This file contains 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_resales_online_api", 'hpf_custom_functionality', 10, 4 ); | |
function hpf_custom_functionality( $post_id, $property, $import_id, $instance_id ) | |
{ | |
if ( | |
isset($property['PropertyFeatures']['Category'][0]['Value']) && | |
is_array($property['PropertyFeatures']['Category'][0]['Value']) && | |
in_array('New Development', $property['PropertyFeatures']['Category'][0]['Value']) | |
) | |
{ | |
// Yes it exists. Do something here. Set a postmeta or similar using update_post_meta() |
This file contains 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('parse_query', 'set_default_location_search_criteria'); | |
function set_default_location_search_criteria() | |
{ | |
if ( !is_admin() && !isset($_GET['location']) ) | |
{ | |
$_GET['location'] = X; // Change X accordingly | |
$_REQUEST['location'] = X; // Change X accordingly | |
} | |
} |
NewerOlder