Skip to content

Instantly share code, notes, and snippets.

@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(); }
add_action( "propertyhive_property_imported_street_json", 'set_low_profile', 10, 2 );
function set_low_profile($post_id, $property)
{
$low_profile = '';
if ( isset($property['salesListing']['is_low_profile']) && $property['salesListing']['is_low_profile'] === true )
{
$low_profile = 'yes';
}
update_post_meta( $post_id, '_low_profile', $low_profile );
}
add_shortcode( 'office_logo', function( $atts = [], $content = '' ) {
// Allow optional overrides
$atts = shortcode_atts(
[
'post_id' => 0, // property post ID (optional override)
'size' => 'full', // image size: thumbnail, medium, large, full
],
$atts,
'office_logo'
add_filter( 'propertyhive_property_query_meta_query', 'custom_commercial_price_query', 10, 2 );
function custom_commercial_price_query( $meta_query, $query )
{
if ( ! is_array( $meta_query ) ) {
$meta_query = array();
}
if (
isset( $_REQUEST['department'] ) && ( $_REQUEST['department'] == 'commercial' || ph_get_custom_department_based_on($_REQUEST['department']) == 'commercial' ) &&
isset( $_REQUEST['commercial_minimum_price'] ) && $_REQUEST['commercial_minimum_price'] != ''
// assuming the id of the form is 'student'. If different change the filter name
add_filter( 'propertyhive_search_form_fields_after_student', 'edit_property_search_form_fields' );
function edit_property_search_form_fields($fields)
{
$fields['_let_type']['value'] = X; // Where X is the Let Type set for Student properties
return $fields; // return the fields
}
add_action( 'propertyhive_before_search_results_loop_item_title', 'add_featured_flag', 15 );
function add_featured_flag()
{
global $property;
if ( $property->featured == 'yes' )
{
echo '<div class="flag flag-featured" style="position:absolute; text-transform:uppercase; font-size:13px; box-sizing:border-box; padding:7px 20px; top:0; left:97px; color:#FFF; background:#04301c !important;">Featured</div>';
}
}
@propertyhive
propertyhive / gist:1586fe59510210437a7424c31e3599cb
Last active October 30, 2025 23:16
Change Kato XML descriptions and order
add_filter( 'propertyhive_kato_xml_descriptions', 'change_kato_description_order', 10, 2 );
function change_kato_description_order( $descriptions, $import_id )
{
return array(
'specification_description',
'location',
'marketing_text_1',
'marketing_text_2',
'marketing_text_3',
'marketing_text_4',
@propertyhive
propertyhive / gist:15c754e7395fd5f8e6c6e7bcd3dca844
Created October 9, 2025 11:28
Hide Kato Units Table Columns
add_filter( 'propertyhive_import_kato_units_description_table_header_columns', 'remove_header_cols');
function remove_header_cols($header_columns)
{
if ( isset($header_columns['rent']) ) { unset($header_columns['rent']); }
if ( isset($header_columns['availability']) ) { unset($header_columns['availability']); }
return $header_columns;
}
add_filter( 'propertyhive_import_kato_units_description_table_data_columns', 'remove_data_cols', 10, 3);