Skip to content

Instantly share code, notes, and snippets.

add_action( 'wp_ajax_nopriv_houzez_agent_send_message', 'custom_houzez_form_function' );
add_action( 'wp_ajax_houzez_agent_send_message', 'custom_houzez_form_function' );
function custom_houzez_form_function()
{
// do stuff here
}
add_filter( 'houzez_property_feed_xml_mapped_field_value', 'only_content_on_first_import', 10, 5 );
function only_content_on_first_import($content, $property, $field, $import_id, $post_id = '')
{
if ( $field != 'post_content' )
{
return $content;
}
if ( empty($post_id))
{
add_filter( 'propertyhive_taxonomy_hide_empty_args', function( $args, $field, $term_id ) {
if ($field['type'] == 'location')
{
// Make sure 'tax_query' exists
if ( !isset( $args['tax_query'] ) ) {
$args['tax_query'] = array();
}
// Add condition to exclude properties where 'availability' taxonomy term is 'Sold'
$args['tax_query'][] = array(
add_action( "propertyhive_property_imported_loop_json", 'set_negotiator_from_loop', 10, 3 );
function set_negotiator_from_loop( $post_id, $property, $import_id )
{
// Negotiator A
if ( $import_id == 111 ) // change 111 for import ID
{
update_post_meta( $post_id, '_negotiator_id', 1 ); // change 1 for WP user ID
}
// Negotiator B
add_action( "propertyhive_property_imported_agentsinsight_xml", 'import_fitted_information', 10, 2 );
function import_fitted_information($post_id, $property)
{
$fitted_information = '';
if (
isset($property->fitted) && (string)$property->fitted == 't' &&
isset($property->fitted_comment) && (string)$property->fitted_comment != '' )
{
$fitted_information = (string)$property->fitted_comment;
add_action( 'elementor/query/simons_on_market_properties', 'elementor_simons_on_market_properties' );
public function elementor_simons_on_market_properties( $query )
{
// maintain order set in Loop Carousel options
$original_orderby = $query->get( 'orderby' );
$original_order = $query->get( 'order' );
PH()->query->property_query( $query ); // this will filter on_market
// Set the custom post type
add_filter( 'propertyhive_rex_property_request_body', 'request_sold_and_let_only' );
function request_sold_and_let_only( $data )
{
$data['criteria'] = array(
array(
"name" => "listing.system_listing_state",
"type" => "in",
"value" => array("sold", "leased")
),
// uncomment the below if you only want to import properties with 'publish_to_external' ticked
add_action( "propertyhive_property_imported_street_json", 'store_raw_property_data', 10, 2 );
function store_raw_property_data($post_id, $property)
{
update_post_meta( $post_id, '_mikes_property_import_data', $property );
}
@propertyhive
propertyhive / gist:1ff79d6d48e2da4a46adca51f8771942
Created April 1, 2025 12:12
Ignore address fields when radius is being searched
add_filter('propertyhive_radial_search_ignore_address', 'ignore_address');
function ignore_address($ignore)
{
return true;
}
add_action( "propertyhive_sturents_property_imported", 'set_status_on_sturents', 10, 2 );
function set_status_on_sturents( $post_id, $property )
{
wp_suspend_cache_invalidation( true );
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
wp_set_post_terms( $post_id, 5, 'availability' ); // Change 5 accordingly to new 'For Sale' status
wp_suspend_cache_invalidation( false );