Skip to content

Instantly share code, notes, and snippets.

@g-maclean
g-maclean / snippet.php
Created September 8, 2026 18:54
Property Hive - 10ninety - Import Searchable Area and include it in search
add_action(
'propertyhive_property_imported_10ninety_xml',
'import_includes_searchable_area',
10,
2
);
function import_includes_searchable_area( $post_id, $property ) {
$searchable_areas = array();
@g-maclean
g-maclean / snippet.php
Created August 24, 2026 15:38
Property Hive - Agency Pilot - Use FileRef OR ID as ref
add_filter( 'propertyhive_property_imported_agency_pilot_api', 'import_ap_reference_number', 10, 2 );
function import_ap_reference_number( $post_id, $property )
{
$reference_number = ! empty( $property['FileRef'] )
? $property['FileRef']
: $property['ID'];
update_post_meta( $post_id, '_reference_number', $reference_number );
}
@g-maclean
g-maclean / snippet.php
Created August 12, 2026 10:49
Property Hive - Apex 27 - Home Reports only import URL
// Remove the Home Reports importer that downloads the file
remove_action(
'propertyhive_property_imported_apex27_xml',
array( PHHR(), 'import_apex27_xml_home_reports' ),
10
);
// Add our replacement importer
add_action(
'propertyhive_property_imported_apex27_xml',
@g-maclean
g-maclean / snippet.php
Created August 9, 2026 22:01
Property Hive - Elementor - Show only properties of a custom department with a parent/child relation
add_action(
'elementor/query/plotspropertyquery',
'elementor_query_plots'
);
function elementor_query_plots( $query ) {
$current_property_id = get_queried_object_id();
if ( ! $current_property_id ) {
@g-maclean
g-maclean / gist:146a11e1527993c8f7f44821a853e22b
Last active August 3, 2026 15:46
Property Hive - Reapit - Import extrasField extra fields
add_filter(
'propertyhive_reapit_foundations_json_properties_url_parameters',
'extra_fields_in_reapit'
);
function extra_fields_in_reapit( $url_parameters )
{
$url_parameters['extrasField'] = array(
//'pLongDesc', //uncomment if standard longDescription field is not present
'pAccomComp',
@g-maclean
g-maclean / gist:3e7c7db879d079d1bb082e204630befa
Created July 29, 2026 20:37
Property Hive - Kyero Export - Change Type Options
add_filter('ph_kyero_feed_type_mapping_options', 'my_kyero_type_mapping', 10, 2);
function my_kyero_type_mapping($mapping, $custom_field) {
// Add a new property type
$mapping['bungalow'] = 'Bungalow';
// Change an existing mapping
$mapping['villa'] = 'Luxury Villa';
@g-maclean
g-maclean / gist:edfc0a60b81a41c090a87a6aa0ef77b5
Last active July 27, 2026 17:17
Property Hive - Elementor - Custom query ID for all departments + marketing flag filter
//seems to be a conflict, when using the loop carousel at least between query ID code and the tax filters, so it needs to be hardcoded into the query ID
add_action(
'elementor/query/allfeaturedpropertiesquery',
'elementor_query_all_featured_properties'
);
function elementor_query_all_featured_properties( $query )
{
PH()->query->property_query( $query );
@g-maclean
g-maclean / snippet.php
Created July 27, 2026 13:13
Property Hive - Make property type multiselect
add_action('wp_footer', function () {
?>
<script>
jQuery(function ($) {
$(document).on('ph:toggleSearchDepartment', function () {
$('#property_type')
.attr('multiple', true)
.attr('name', 'property_type[]');
});
@g-maclean
g-maclean / snippet.js
Last active July 17, 2026 18:56
Property Hive - Set default property type in search form
add_action('wp_footer', function () {
?>
<script>
jQuery(function ($) {
// Only run if a property search form exists on the page
if (!$('.property-search-form').length) {
return;
}
@g-maclean
g-maclean / snippet.php
Created July 15, 2026 07:20
Property Hive - Street - One-time set on market change date to last updated date (for initial imports)
//useful for setting the default date changed in PH (on market change date) to the last updated date in street for initial imports to have good sorting from the beginning. Another approach should probably be used to ALWAYS use the street date
add_action( 'propertyhive_property_imported_street_json', 'set_on_market_change_date_from_updated_at', 10, 2 );
function set_on_market_change_date_from_updated_at( $post_id, $property )
{
if ( ! empty( $property['attributes']['updated_at'] ) )
{
// Convert ISO8601 format (2026-07-06T14:09:07+01:00)
// to WordPress datetime format (2026-07-06 14:09:07)