Skip to content

Instantly share code, notes, and snippets.

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) )
{
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 ($property['tags'] == null || !is_array($property['tags'])) {
continue;
}
add_action( "propertyhive_property_imported_kyero_xml", 'set_kyero_statuses', 10, 3 );
function set_kyero_statuses( $post_id, $property, $import_id )
{
wp_suspend_cache_invalidation( true );
wp_defer_term_counting( true );
wp_defer_comment_counting( true );
$department = 'residential-sales';
if ( isset($property->price_freq) && ( (string)$property->price_freq == 'week' || (string)$property->price_freq == 'month' ) )
{
@propertyhive
propertyhive / gist:f0fb3d4eb0a6b504ed42cf7d5192c6cd
Created May 23, 2025 08:59
Shortcode to output property owners
add_shortcode('property_address', 'property_owners');
function property_owners()
{
global $property;
if ( !isset($property->id) ) {
return;
}
ob_start();
add_filter( 'propertyhive_use_propertyhive_templates', 'dont_use_hive_templates' );
function dont_use_hive_templates($use_ph)
{
return false;
}
@propertyhive
propertyhive / gist:61862d8414bddd37ee6fb999ba0f66d5
Created May 13, 2025 16:59
Send enquiries to property owner/landlord
add_filter( 'propertyhive_property_enquiry_to', 'customise_enquiry_to', 10, 2 );
function customise_enquiry_to( $to, $property_ids )
{
foreach ($property_ids as $property_id)
{
$owner_ids = get_post_meta( $property_id, '_owner_contact_id', TRUE );
if ( $owner_ids == '')
return $to;
jQuery(document).ready(function()
{
jQuery(document).on('ph:infinite_scroll_loading_properties', function(event)
{
// do something here
});
});
add_filter( 'gettext', 'propertyhive_book_viewing_label', 99, 3 );
function propertyhive_book_viewing_label( $translated_text, $text, $domain ) {
switch ( $translated_text )
{
case 'Book Viewing' :
{
$translated_text = 'My Viewing Button label Here';
break;
}
/*
* Random display of properties option
*/
add_filter('propertyhive_default_search_results_orderby', 'change_default_order');
function change_default_order($orderby)
{
return 'rand';
}
add_action( "propertyhive_property_imported_inmobalia_xml", 'import_sizes', 10, 3 );
function import_sizes( $post_id, $property, $import_id )
{
if ( isset($property->mts_build) )
{
update_post_meta( $post_id, '_build_area', (string)$property->mts_build );
}
if ( isset($property->mts_plot) )
{