Skip to content

Instantly share code, notes, and snippets.

add_filter( 'propertyhive_countries', 'add_eg' );
function add_eg($countries)
{
$countries['EG'] = array(
'name' => 'Egypt',
'currency_code' => 'EGP',
'currency_symbol' => 'E£',
'currency_prefix' => true
);
@propertyhive
propertyhive / gist:7efab68d409c0269833f400f1c871fa8
Created January 6, 2026 12:46
Don't update title on subsequent updates
add_filter( 'houzez_property_feed_xml_mapped_field_value', 'only_title_on_first_import', 10, 5 );
function only_title_on_first_import($content, $property, $field, $import_id, $post_id = '')
{
if ( $field != 'post_title' )
{
return $content;
}
if ( empty($post_id))
{
@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';
}