Skip to content

Instantly share code, notes, and snippets.

@propertyhive
propertyhive / gist:fb102dc018f2e65cf8322f3af6d2e233
Created December 4, 2025 10:50
Use full address in enquiry subject
add_filter( 'propertyhive_property_enquiry_subject', 'customise_enquiry_subject', 10, 2 );
function customise_enquiry_subject($subject, $property_ids)
{
if ( count($property_ids) == 1 )
{
$property = new PH_Property((int)$property_ids[0]);
$subject = __( 'New Property Enquiry', 'propertyhive' ) . ': ' . $property->get_formatted_full_address();
}
else
{
add_action( "propertyhive_wpresidence_property_synced", 'set_property_user', 10, 3 );
function set_property_user($property_id, $post_id, $synced)
{
update_post_meta($post_id, 'property_user', '123'); // Change 123 to the Id of the user in WP you wish to assign to
}
BEFORE (lines 557-590):
if ( $rule['equal'] == '*' )
{
$found = true;
}
elseif (
( !isset($rule['operator']) || ( isset($rule['operator']) && $rule['operator'] == '=' ) ) && trim($value_to_check) == $rule['equal']
)
{
add_filter( 'propertyhive_microsoft_graph_event_negotiator_ids', 'only_certain_members', 10, 2 );
function only_certain_members( $attending_wordpress_user_ids, $post_id )
{
if ( empty($attending_wordpress_user_ids) )
{
$attending_wordpress_user_ids = array(1, 2, 3, 4); // CHANGE THIS!!
}
return $attending_wordpress_user_ids;
}
@propertyhive
propertyhive / gist:08ddb92b111414c46f0fe6e7941dda6c
Created November 17, 2025 20:07
Order student search by custom _pppm field when ordering by price
add_filter( 'propertyhive_get_search_results_ordering_args', 'order_students_by_pppm' );
function order_students_by_pppm($args)
{
if (
( !isset($_REQUEST['department']) && get_option( 'propertyhive_primary_department', '' ) == 'student' )
||
( isset($_REQUEST['department']) && $_REQUEST['department'] == 'student' )
)
{
// if searching student properties
add_filter( 'propertyhive_price_output', 'student_per_person', 10, 5 );
function student_per_person($return, $property, $currency, $prefix, $suffix)
{
if ( $property->department != 'student' )
{
return $return;
}
$bedrooms = (int)$property->bedrooms;
if ( empty($bedrooms) )
do_action( "propertyhive_property_imported_kato_xml", 'cater_for_sale_and_let', 10, 3 );
function cater_for_sale_and_let( $post_id, $property, $import_id )
{
$types = [];
foreach ($property->availabilities->type as $type) {
$types[] = (string)$type['id'];
}
if (in_array('tolet', $types) && in_array('forsale', $types))
{
@propertyhive
propertyhive / gist:d6724e444ebc24979ef873f3c4c779a8
Last active October 31, 2025 14:31
Output 'studio' when bedrooms is 0
add_filter( 'propertyhive_get_detail', 'change_bedrooms', 10, 3 );
function change_bedrooms($value, $key, $property)
{
if ( $key != 'bedrooms' ) { return $value; }
if ( $property->_bedrooms == '0' )
{
return 'Studio';
}
add_filter( "propertyhive_arthur_json_properties_due_import", 'property_tags_on_unit', 10, 2 );
function property_tags_on_unit( $properties, $import_id )
{
foreach ( $properties as $i => $property )
{
$tags = isset($property['tags']) && !empty($property['tags']) ? $property['tags'] : array();
if ( !empty($tags) )
{
if (
add_action( 'elementor/query/onmarketpropertyquery', 'handle_sold_tickbox' );
function handle_sold_tickbox($query)
{
$tax_query = $q->get('tax_query');
if ( !isset($_GET['include_sold_stc']) )
{
// Not ticked. Only include available properties
if (!is_array($tax_query)) { $tax_query = array(); }