This file contains hidden or 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
//flush rewrite rules after adding: Dashboard->Settings->Permalinks->Save | |
add_action( 'init', 'iamproperty_rtdf_endpoints_rewrite_rules'); | |
function iamproperty_rtdf_endpoints_rewrite_rules() { | |
add_rewrite_rule( | |
'^([0-9]+)/sendpropertydetails[/]?', | |
'index.php?rtdf=1&rtdf_action=sendpropertydetails&import_id=$matches[1]', | |
'top' | |
); | |
add_rewrite_rule( | |
'^([0-9]+)/removeproperty[/]?', |
This file contains hidden or 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_reapit_foundations_json", 'use_ref_as_post_title', 10, 2 ); | |
function use_ref_as_post_title($post_id, $property) | |
{ | |
if ( isset($property['id']) && $property['id'] != '' ) | |
{ | |
$new_title = $property['id']; | |
$my_post = array( | |
'ID' => $post_id, | |
'post_title' => wp_strip_all_tags( $new_title ), | |
'post_name' => wp_strip_all_tags( $new_title ) |
This file contains hidden or 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_avantio_xml_image_size', 'use_original_image_url', 10, 2); | |
function use_original_image_url($image, $property) | |
{ | |
return (string)$image->OriginalURI; | |
} |
This file contains hidden or 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
// remove size column | |
function remove_size_column($columns) { | |
unset($columns['size']); | |
return $columns; | |
} | |
add_filter('manage_edit-property_columns', 'remove_size_column', 11); | |
// Step 1: Add the Location column to the Property post type | |
add_filter('manage_property_posts_columns', 'add_property_location_column'); | |
function add_property_location_column($columns) { |
This file contains hidden or 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_kyero_xml", 'import_virtual_tour_kyero', 10, 2 ); | |
function import_virtual_tour_kyero( $post_id, $property ) | |
{ | |
if ( isset($property->virtual_tour_url) && !empty($property->virtual_tour_url) ) | |
{ | |
update_post_meta( $post_id, '_virtual_tour_0', (string)$property->virtual_tour_url ); | |
update_post_meta( $post_id, '_virtual_tour_label_0', __( 'Virtual Tour', 'propertyhive' )); | |
} | |
} |
This file contains hidden or 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_shortcode('force_login_shortlist_button', 'force_login_shortlist_button'); | |
function force_login_shortlist_button() | |
{ | |
if ( is_user_logged_in() ) | |
{ | |
return do_shortcode('[shortlist_button class="action-shortlist"]'); | |
} | |
$assets_path = str_replace( array( 'http:', 'https:' ), '', PH()->plugin_url() ) . '/assets/'; |
This file contains hidden or 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_reapit_foundations_json", 'import_ber_foundations', 10, 2 ); | |
function import_ber_foundations( $post_id, $property ) | |
{ | |
$rating = isset( $property['regional']['irl']['buildingEnergyRating']['rating'] ) ? $property['regional']['irl']['buildingEnergyRating']['rating'] : ''; | |
$ber_id = isset( $property['regional']['irl']['buildingEnergyRating']['refNumber'] ) ? $property['regional']['irl']['buildingEnergyRating']['refNumber'] : ''; | |
update_post_meta( $post_id, '_ber_rating', $rating ); | |
update_post_meta( $post_id, '_ber_id', $ber_id ); | |
} |
This file contains hidden or 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_single_property_actions', 'force_user_login_for_shortlist', 999 ); | |
function force_user_login_for_shortlist( $actions ) | |
{ | |
//if user is logged in skip | |
if ( is_user_logged_in() ) | |
{ | |
return $actions; | |
} | |
// get shortlist action |
This file contains hidden or 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
//NOT for main search page, but for standalone loop grids | |
//use orderbyavailabilitychange in the queryID field | |
function custom_elementor_loop_order_availability_change($query) { | |
$query->set('meta_key', '_availability_change_date'); | |
$query->set('orderby', 'meta_value'); | |
$query->set('order', 'DESC'); | |
} | |
add_action('elementor/query/orderbyavailabilitychange', 'custom_elementor_loop_order_availability_change'); |
This file contains hidden or 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_due_import", 'remove_non_auction_properties' ); | |
function remove_non_auction_properties( $properties ) | |
{ | |
$office_ids = array( 1, 2, 3 ); | |
$new_properties = array(); | |
foreach ( $properties as $property ) | |
{ | |
if ( isset( $property['officeIds'] ) && is_array( $property['officeIds'] ) && count( $property['officeIds'] ) > 0 ) | |
{ | |
if(in_array($property['officeIds'][0], $office_ids)) |
NewerOlder