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, | |
| ); |
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_acquaint_xml", 'import_floorarea_acquaint', 10, 2 ); | |
| function import_floorarea_acquaint( $post_id, $property ) | |
| { | |
| if ( isset($property->floorarea) && !empty($property->floorarea) ) | |
| { | |
| update_post_meta( $post_id, '_floor_area', (string)$property->floorarea . ' sq ft' ); | |
| } | |
| } |
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_kato_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_vebra_api_xml", "assign_office_on_custom_location", 10, 2 ); | |
| function assign_office_on_custom_location($post_id, $property) | |
| { | |
| // custom_location value => Office ID | |
| // find office IDs in the "Edit Office" button URL in Property Hive -> Settings -> Offices | |
| $mappings = array( | |
| 'Cambridge' => 1, | |
| 'Huntingdon' => 2, | |
| ); | |
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
| // Reorder Location dropdown | |
| add_filter( 'get_terms', 'custom_order_propertyhive_locations', 10, 4 ); | |
| function custom_order_propertyhive_locations( $terms, $taxonomies, $args, $term_query ) { | |
| if ( in_array( 'location', $taxonomies ) && is_admin() === false ) { | |
| $custom_order = array( 'Edinburgh', 'East Lothian' ); | |
| usort( $terms, function ( $a, $b ) use ( $custom_order ) { | |
| $pos_a = array_search( $a->name, $custom_order ); |
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('init', 'ph_custom_elementor_query_ids'); | |
| function ph_custom_elementor_query_ids() { | |
| add_action( 'elementor/query/featuredpropertyquerysales', 'elementor_query_featured_only_sales' ); | |
| add_action( 'elementor/query/featuredpropertyquerylettings', 'elementor_query_featured_only_lettings' ); | |
| } | |
| function elementor_query_featured_only_sales( $query ) | |
| { | |
| $original_orderby = $query->get( 'orderby' ); | |
| $original_order = $query->get( 'order' ); |
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_unit_imported_arthur_json", 'use_ref_as_post_title', 10, 2 ); | |
| add_action( "propertyhive_property_imported_arthur_json", 'use_ref_as_post_title', 10, 2 ); | |
| function use_ref_as_post_title($post_id, $property) | |
| { | |
| if ( isset($property['ref']) && $property['ref'] != '' ) | |
| { | |
| $new_title = sanitize_title( wp_strip_all_tags($property['ref']) ); | |
| $my_post = array( | |
| 'ID' => $post_id, | |
| 'post_title' => $new_title, |
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
| //flush rewrite rules after adding: Dashboard->Settings->Permalinks->Save | |
| add_action( 'init', 'iamproperty_rtdf_endpoints_rewrite_rules'); | |
| function iamproperty_rtdf_endpoints_rewrite_rules() { | |
| add_rewrite_rule( | |
| '^([0-9]+)/sendpropertydetails[/]?', | |
| 'index.php?rtdf=1&rtdf_action=sendpropertydetails&import_id=$matches[1]', | |
| 'top' | |
| ); | |
| add_rewrite_rule( | |
| '^([0-9]+)/removeproperty[/]?', |