This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'elementor/query/soldpropertyquery', 'sold_only_elementor_query', 99 ); | |
function sold_only_elementor_query( $query ) | |
{ | |
$tax_query = $query->get('tax_query'); | |
$tax_query[] = array( | |
'taxonomy' => 'availability', | |
'terms' => array(123), // replace 123 for the 'Sold' ID found under 'Property Hive > Settings > Custom Fields > Availabilities' | |
'operator' => 'IN', | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'propertyhive_reapit_foundations_json_properties_url_parameters', 'set_statuses_in_reapit' ); | |
function set_statuses_in_reapit( $statuses ) | |
{ | |
return array( 'forSale', 'underOffer', 'exchanged' ); | |
} | |
add_filter( 'propertyhive_reapit_foundations_json_import_lettings_statuses', 'set_lettings_statuses_in_reapit' ); | |
function set_lettings_statuses_in_reapit( $statuses ) | |
{ | |
return array( 'toLet', 'underOffer', 'arrangingTenancy', 'tenancyCurrent' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'propertyhive_reapit_foundations_json_properties_url_parameters', 'filter_by_office' ); | |
function filter_by_office( $url_parameters ) | |
{ | |
$url_parameters['officeId'] = array( 'ABC', 'DEF' ); // List of office IDs you DO want to include | |
return $url_parameters; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( "propertyhive_property_imported_agentsinsight_xml", 'set_tenure', 10, 2 ); | |
function set_tenure($post_id, $property) | |
{ | |
$tenure = ''; | |
if ( isset($property->floor_units) && !empty($property->floor_units) ) | |
{ | |
$floor_units = $property->floor_units->children(); | |
foreach ($floor_units as $floor_unit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'propertyhive_register_post_type_property', 'change_property_slug' ); | |
function change_property_slug( $args ) | |
{ | |
$args['rewrite'] = array('slug' => 'rent-serviced-offices', 'with_front' => false, 'feeds' => true); | |
return $args; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( "propertyhive_property_imported_jet", "keep_sold_properties_off_market", 10, 2 ); | |
function keep_sold_properties_off_market($post_id, $property) | |
{ | |
if ( isset($property['selling']['status']) && strtolower($property['selling']['status']) == 'completed' ) | |
{ | |
// Yes this property is completed. Make sure it doesn't go on the market | |
wp_suspend_cache_invalidation( true ); | |
wp_defer_term_counting( true ); | |
wp_defer_comment_counting( true ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'propertyhive_reapit_foundations_json_import_sales_statuses', 'foundations_selling_statuses' ); | |
function foundations_selling_statuses( $statuses ) | |
{ | |
$statuses[] = 'completed'; | |
return $statuses; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('nav_menu_css_class', 'custom_menu_item_classes', 10, 3); | |
function custom_menu_item_classes($classes, $item, $args) | |
{ | |
if ( is_post_type_archive('property') ) { | |
// Get the current query parameters | |
if (isset($_GET['department']) && $_GET['department'] == 'residential-lettings') { | |
// If 'department' is set to 'residential-lettings', highlight the "Property to Rent" menu item. | |
if ($item->title == 'Property To Rent') { | |
$classes[] = 'current-menu-item'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( "propertyhive_property_imported_rtdf", 'rtdf_import_stuff', 10, 2 ); | |
function rtdf_import_stuff($post_id, $property) | |
{ | |
$found_agent = false; | |
if ( isset($property['assignedAgentName']) && $property['assignedAgentName'] != '' ) | |
{ | |
$args = array( | |
'post_type' => 'agent', | |
's' => $property['assignedAgentName'], | |
'posts_per_page' => 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'propertyhive_property_imported_jupix_xml', 'set_custom_department_on_import', 10, 2); | |
function set_custom_department_on_import( $post_id, $property ) | |
{ | |
if ( (string)$property->department == 'Agricultural' ) | |
{ | |
update_post_meta( $post_id, '_department', 'rural-agricultural' ); | |
} | |
if ( (string)$property->developmentOpportunity == '1' ) | |
{ |
NewerOlder