Skip to content

Instantly share code, notes, and snippets.

// Adds a Query ID 'soldpropertyquery' that can be used in Loop Grid widget
add_action( 'elementor/query/soldpropertyquery', 'elementor_query_sold_only' );
function elementor_query_sold_only( $query ) {
// Ensure we only query the 'properties' custom post type
$query->set( 'post_type', 'property' );
// Add tax query for Availability = Sold
$tax_query = array(
array(
add_filter( 'houzez_property_feed_propctrl_off_market_statuses', 'exclude_pending' );
function exclude_pending($exclude_statuses)
{
$exclude_statuses[] = 'pending';
return $exclude_statuses;
}
add_action( "houzez_property_feed_property_imported_kyero", 'import_custom_plans_node', 10, 4 );
function import_custom_plans_node($post_id, $property, $import_id, $instance_id)
{
$floorplans = array();
if (isset($property->plans) && !empty($property->plans))
{
foreach ($property->plans as $plans)
{
if (!empty($plans->plan))
add_filter('update_post_metadata', function ($check, $object_id, $meta_key, $meta_value, $prev_value) {
if ($meta_key !== 'fave_property_id') {
return $check;
}
// 1) Manual edits in wp-admin should always be allowed.
// We treat "manual" as the classic post edit save (not AJAX/REST).
$is_manual_admin_save =
is_admin()
add_filter( 'propertyhive_property_enquiry_to', 'custom_enquiry_to_address', 10, 2 );
function custom_enquiry_to_address( $to, $property_ids )
{
$property_id = is_array($property_ids) ? (int)$property_ids[0] : (int)$property_ids;
if ( empty($property_id) ) { return $to; }
$property = new PH_Property($property_id);
if ( $property->imported_id == 'REAPIT-ID-HERE' )
add_filter( 'houzez_property_feed_insert_postarr', 'strip_html_from_ea_description', 10, 3 );
add_filter( 'houzez_property_feed_update_postarr', 'strip_html_from_ea_description', 10, 3 );
function strip_html_from_ea_description($data, $property, $import_id)
{
$data['post_content'] = strip_tags($data['post_content']); // REMOVE THE HTML HERE
return $data;
}
$tax_query = $query->get('tax_query');
if ( !is_array($tax_query) ) { $tax_query = array(); }
$tax_query[] = [
'taxonomy' => 'availability',
'field' => 'ID',
'terms' => ['4', '5', '104'],
'operator' => 'NOT IN',
];
$query->set('tax_query', $tax_query);
add_action('propertyhive_after_search_form_controls', 'add_reset_button', 10, 2 );
function add_reset_button( $id, $form_controls )
{
echo '<input type="reset" value="Reset" />';
}
add_filter( 'houzez_property_feed_expertagent_departments_to_import', 'customise_ea_depts' );
function customise_ea_depts($departments)
{
$departments[] = 'catering';
$departments[] = 'development';
$departments[] = 'flat';
$departments[] = 'hotels';
$departments[] = 'house';
$departments[] = 'industrial';
$departments[] = 'investment';
add_filter( 'houzez_property_feed_update_postarr', 'keep_title', 10, 4 );
function keep_title($data, $property, $import_id, $post_id)
{
if ( empty($post_id))
{
return $data;
}
$post = get_post( $post_id );