Skip to content

Instantly share code, notes, and snippets.

add_filter( 'elementor/frontend/widget/before_render', function( $widget )
{
// Only target specific widget types if needed
if ( $widget->get_name() !== 'property-availability' ) {
return;
}
// Get current post ID
$post_id = get_the_ID();
add_action( "houzez_property_feed_property_imported_xml", 'import_custom_features', 10, 4 );
function import_custom_features( $post_id, $property, $import_id, $instance_id )
{
wp_suspend_cache_invalidation( true );
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
wp_delete_object_term_relationships( $post_id, "property_feature" );
// Heating
@propertyhive
propertyhive / gist:8b16a992bcb5381286d5ce55bd74de48
Last active June 20, 2025 09:59
Overwrite taxonomies links in AIOSEO breadcrumbs
add_filter( 'aioseo_breadcrumbs_trail', 'steves_breadcrumb_change' );
function steves_breadcrumb_change($breadcrumbs)
{
$new_breadcrumbs = array();
foreach ( $breadcrumbs as $breadcrumb )
{
if ( isset($breadcrumb['type']) && $breadcrumb['type'] == 'taxonomy' )
{
if ( $breadcrumb['label'] == 'To Let' || $breadcrumb['label'] == 'Let Agreed' || $breadcrumb['label'] == 'Let' )
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) )
{