Skip to content

Instantly share code, notes, and snippets.

$my_post = array(
'ID' => $post_id,
'post_title' => wp_strip_all_tags( $unit_display_address ),
'post_excerpt' => ( ( isset($unit['short_description']) && $unit['short_description'] != '' ) ? $unit['short_description'] : '' ),
'post_content' => ( ( isset($unit['description']) && $unit['description'] != '' ) ? $unit['description'] : ( ( isset($unit['short_description']) && $unit['short_description'] != '' ) ? $unit['short_description'] : '' ) ),
);
<?php
$args = array(
'post_type' => 'property',
'fields' => 'ids',
'nopaging' => true,
'meta_query' => array(
array(
'key' => '_department',
'value' => 'village-and-country'
),
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function() { default_lettings_button() }, 100 ); // delay execution of defaulting
});
function default_lettings_button()
{
var checked_department = jQuery('input[name="department"]:checked').val();
if ( checked_department == 'residential-lettings' )
{
toggleActive(document.querySelector('.control-department label[for="department_residential-lettings"]'));
add_filter( 'propertyhive_rest_api_property_fields', 'add_additional_fields_to_property_rest_api' );
function add_additional_fields_to_property_rest_api($field_array)
{
$field_array[] = 'address_name_number';
return $field_array;
}
add_filter( "houzez_property_feed_properties_due_import_rex", 'niche_homes_only', 10, 2 );
function niche_homes_only( $properties, $import_id )
{
$new_properties = array();
foreach ( $properties as $property )
{
if ( isset($property['account']['id']) && $property['account']['id'] == '4281' ) // 4281 = accountID for Niche Homes
{
$new_properties[] = $property;
function remove_just_listed_flag() {
$args = array(
'post_type' => 'property',
'posts_per_page' => -1,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'marketing_flag',
'field' => 'slug',
'terms' => 'just-listed',
add_action( 'propertyhive_before_property_import_cron', 'download_caldes_xml' );
function download_caldes_xml()
{
$xml_url = 'https://example.com/path/to/your/caldes.xml'; // set to URL provided by Caldes
$local_dir = $_SERVER['DOCUMENT_ROOT'] . '/wp-content/uploads/ph_import'; // change accordingly to your setup
// Local file path
$local_file = $local_dir . '/caldes.xml';
// Use file_get_contents to fetch the XML content
@propertyhive
propertyhive / gist:0b6537826a32f31d6b5e6e068604ca50
Created May 20, 2024 08:43
StuRents Book Now URL (updated)
// optional if wanting to remove the default 'Make Enquiry' button
//remove_action( 'propertyhive_property_actions_list_start', 'propertyhive_make_enquiry_button', 10 );
add_filter( 'propertyhive_single_property_actions', 'add_custom_make_enquiry_action' );
function add_custom_make_enquiry_action( $actions )
{
global $property;
if ( strtolower($property->availability) == 'sold out' )
{
add_action( 'elementor/query/onmarketauctionpropertyquery', 'elementor_query_on_market_auction_only' );
function elementor_query_on_market_auction_only( $query )
{
$_GET['department'] = 'auction';
$_REQUEST['department'] = 'auction';
PH()->query->property_query( $query );
// Set the custom post type
$query->set( 'post_type', [ 'property' ] );
@propertyhive
propertyhive / gist:18f49e8f5ac37fc0713d1e3929653e77
Created May 17, 2024 05:35
Send different floorplan size to RM in RTDF
add_filter( 'ph_rtdf_floorplan_size', 'diff_fp_in_rtdf' );
function diff_fp_in_rtdf( $size )
{
return 'full';
}