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_electricity_types', 'custom_elec_types' ); | |
function custom_elec_types($types) | |
{ | |
$types['my_custom_type_1'] = 'My Custom Type 1'; | |
$types['my_custom_type_2'] = 'My Custom Type 2'; | |
return $types; | |
} |
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
<?php | |
add_action('rest_api_init', function () { | |
register_rest_route('ppa/v1', '/update-property/', array( | |
'methods' => 'POST', | |
'callback' => 'update_property', | |
'permission_callback' => 'basic_auth_permission_check' | |
)); | |
}); |
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_search_form_fields_after', 'remove_address_three_hidden', 10, 1 ); | |
function remove_address_three_hidden($form_controls) | |
{ | |
if (isset($form_controls['address_three'])) { unset($form_controls['address_three']); } | |
return $form_controls; | |
} |
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( "houzez_property_feed_properties_due_import_alto", 'specific_firmid', 10, 2 ); | |
function specific_firmid( $properties, $import_id ) | |
{ | |
$new_properties = array(); | |
foreach ( $properties as $property ) | |
{ | |
$property_attributes = $property->attributes(); | |
if ( (string)$property_attributes['firmid'] == '38942' ) |
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_property_query_meta_query', 'filter_search_by_address_three', 10, 2 ); | |
function filter_search_by_address_three( $meta_query, $query ) | |
{ | |
if ( isset( $_REQUEST['address_three'] ) ) | |
{ | |
$meta_query[] = array( | |
'key' => '_address_three', | |
'value' => sanitize_text_field($_REQUEST['address_three']), | |
); | |
} |
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_search_form_fields_after', 'edit_property_search_form_fields' ); | |
function edit_property_search_form_fields($fields) | |
{ | |
global $wpdb; | |
$options = array('' => 'No Preference'); | |
// Query to get distinct meta values for the '_building' meta key | |
$results = $wpdb->get_col( | |
$wpdb->prepare( |
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/allonmarketpropertyquerynoordering ', 'query_but_random', 99 ); | |
function query_but_random( $query ) | |
{ | |
PH()->query->property_query( $query ); | |
$query->set( 'orderby', 'rand' ); | |
// Set the custom post type | |
$query->set( 'post_type', [ 'property' ] ); |
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_loop_json_properties_due_import", 'filter_out_properties_with_no_images', 10, 2 ); | |
function filter_out_properties_with_no_images($properties, $import_id) | |
{ | |
$new_properties = array(); | |
foreach ($properties as $property) | |
{ | |
if ( isset($property['images']) && is_array($property['images']) && !empty($property['images']) ) | |
{ | |
// only return if images present |
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('pre_get_posts', 'to_let_only_by_default'); | |
function to_let_only_by_default($q) | |
{ | |
if (is_admin()) | |
return; | |
if (!$q->is_main_query()) | |
return; | |
if (!$q->is_post_type_archive('property') && !$q->is_tax(get_object_taxonomies('property'))) |
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_search_form_fields_after', 'add_form_control_class_to_form_fields', 99 ); | |
function add_form_control_class_to_form_fields($fields) | |
{ | |
$new_fields = array(); | |
foreach ( $fields as $field ) | |
{ | |
$field['class'] = 'form-control'; | |
$new_fields[] = $field; | |
} | |
NewerOlder