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", 'import_plot_size', 10, 2 ); | |
function import_plot_size($post_id, $property) | |
{ | |
if ( isset($property->surface_area) && isset($property->surface_area->plot) && !empty($property->surface_area->plot) ) { | |
update_post_meta( $post_id, '_plot_size', $property->surface_area->plot ); | |
} | |
} |
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_before_search_results_loop', 'add_view_shortlist_button', 50); | |
function add_view_shortlist_button() { | |
if ( isset($_GET['shortlisted']) && $_GET['shortlisted'] == '1' ) { | |
echo '<div class="view-shortlist-container" style="clear: both;"> | |
<a href="/search/" class="button view-shortlist-button">Back to Search</a> | |
</div>'; | |
} | |
echo '<div class="view-shortlist-container" style="clear: both;"> | |
<a href="/search/?shortlisted=1" class="button view-shortlist-button">View Shortlist</a> | |
</div>'; |
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_vebra_api_xml", 'assign_student_marketing_flag', 10, 2 ); | |
function assign_student_marketing_flag($post_id, $property) | |
{ | |
$is_student = false; | |
wp_remove_object_terms( $post_id, 511, 'marketing_flag' ); //set ID to remove flag | |
if ( isset($property->rm_let_type_id) && strtolower((string)$property->rm_let_type_id) == '3' ) | |
{ | |
$is_student = 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('property_details_list', 'custom_property_details_list_shortcode'); | |
function custom_property_details_list_shortcode($atts) { | |
global $post; | |
$property = new PH_Property($post->ID); | |
$details = array( | |
'Price' => $property->price, | |
'Property Type' => $property->get_property_type(), | |
'Bedrooms' => $property->bedrooms, |
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_thesaurus_xml", 'import_interactive_floorplan', 10, 2 ); | |
function import_interactive_floorplan($post_id, $property) | |
{ | |
$virtual_tours = array(); | |
for ($i = 245; $i <= 247; ++$i) | |
{ | |
if ( | |
$property[$i] != '' && | |
( | |
strpos(strtolower($property[$i]), 'metropix') !== 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_action( "propertyhive_property_imported_jupix_xml", 'assign_parking_taxonomy', 10, 2 ); | |
function assign_parking_taxonomy($post_id, $property) | |
{ | |
if ( isset($property->parking) && isset($property->parking->type) ) | |
{ | |
$parking_types = array(); | |
if (isset($property->parking) && isset($property->parking->type)) { | |
foreach ($property->parking->type as $type) { | |
if (trim((string)$type) != '') { | |
$parking_types[] = sanitize_text_field((string)$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( 'propertyhive_applicant_registration_form_fields', 'remove_location_and_hide_office_id', 10, 1 ); | |
function remove_location_and_hide_office_id( $form_controls ) { | |
// Remove 'location' from the form controls | |
if ( isset($form_controls['location']) ) { | |
unset($form_controls['location']); | |
} | |
// Hide 'office_id' from the form controls | |
if ( isset($form_controls['office_id']) ) { | |
$form_controls['office_id']['type'] = 'hidden'; |
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
jQuery(document).on('ph:toggleSearchDepartment', function() { | |
var selectedDepartment = jQuery('input[name="department"]:checked').val(); | |
if (selectedDepartment === 'student') { | |
jQuery('#minimum_rent option, #maximum_rent option').each(function() { | |
var text = jQuery(this).text(); | |
jQuery(this).text(text.replace(' PCM', ' PW')); | |
}); | |
} else if (selectedDepartment === 'residential-lettings') { | |
jQuery('#minimum_rent option, #maximum_rent option').each(function() { |
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
function custom_pf_button( $atts ) { | |
$property = new PH_Property( get_the_ID() ); | |
// Output the button HTML | |
return sprintf( | |
'<button class="pf-request-viewing-button" data-property-id="%s">Request Viewing</button>', | |
esc_attr( $property->imported_id ) | |
); | |
} | |
add_shortcode( 'pf_viewing_button', 'custom_pf_button' ); |
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
//filter for 10ninety feed that assigns an office based on if it has a prefix for that branch | |
add_action( "propertyhive_property_imported_10ninety_xml", "assign_office_on_10ninety_prefix", 10, 2 ); | |
function assign_office_on_10ninety_prefix($post_id, $property) | |
{ | |
// branch ID => Office ID | |
// find office IDs in the "Edit Office" button URL in Property Hive -> Settings -> Offices | |
$mappings = array( | |
'AB123_' => 1, | |
'CDE45_' => 2, | |
); |
NewerOlder