Skip to content

Instantly share code, notes, and snippets.

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',
);
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'
);
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 : '' );
}
@propertyhive
propertyhive / gist:1adef8099e0ea5c8b440068d83a06b6c
Created June 16, 2025 11:21
Different slug format from Kato XML
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 != '' )
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;
}
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'
)
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) )
{
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;
}
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' ) )
{
@propertyhive
propertyhive / gist:f0fb3d4eb0a6b504ed42cf7d5192c6cd
Created May 23, 2025 08:59
Shortcode to output property owners
add_shortcode('property_address', 'property_owners');
function property_owners()
{
global $property;
if ( !isset($property->id) ) {
return;
}
ob_start();