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
| //adds a new option to the wp bulk options dropdown | |
| // Add a custom bulk action to the dropdown | |
| function add_bulk_delete_media_action($bulk_actions) { | |
| $bulk_actions['delete_attached_media'] = __('Delete Attached Media', 'text-domain'); | |
| return $bulk_actions; | |
| } | |
| add_filter('bulk_actions-edit-property', 'add_bulk_delete_media_action'); | |
| // Handle the custom bulk 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
| // Change default order (optional) | |
| add_filter('propertyhive_default_search_results_orderby', 'change_default_order'); | |
| function change_default_order( $orderby ) | |
| { | |
| return 'title_asc'; // or return ''; if you want PropertyHive's default | |
| } | |
| // Add new sort options to dropdown | |
| add_filter( 'propertyhive_results_orderby', 'ph_add_custom_title_sorting' ); | |
| function ph_add_custom_title_sorting($options) |
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_json", 'assign_location_from_extra_field', 10, 2 ); | |
| function assign_location_from_extra_field( $post_id, $property ) { | |
| $location_set = false; | |
| if ( isset( $property['address']['line3'] ) && trim( $property['address']['line3'] ) != '' ) { | |
| $reapit_location = trim( $property['address']['line3'] ); | |
| $term = term_exists( $reapit_location, 'location' ); | |
| if ( $term !== 0 && $term !== null && isset( $term['term_id'] ) ) { | |
| $location_set = true; | |
| wp_set_object_terms( $post_id, array( (int)$term['term_id'] ), 'location' ); | |
| } |
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( 'elementor/query/similar_properties_query', function( $query ) { | |
| global $property; | |
| // | |
| // STATIC DEFAULTS (taken from the shortcode) | |
| // https://docs.wp-property-hive.com/article/312-shortcodes-similarproperties | |
| // | |
| $atts = array( | |
| //'per_page' => 2, //unused |
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
| function ph_address_no_number_shortcode( $atts ) { | |
| global $property; | |
| // Do nothing if $property object isn't available | |
| if ( ! isset( $property ) || ! is_object( $property ) ) { | |
| return ''; | |
| } | |
| // Shortcode attributes: separator, optional HTML tag, optional class | |
| $atts = shortcode_atts( array( |
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_import_agentsinsight_units_description_table_data_columns', 'custom_data_columns' ); | |
| function custom_data_columns( $columns ) | |
| { | |
| if ( isset($columns['name']) ) | |
| { | |
| // Map of codes to labels | |
| $floor_map = array( | |
| 'lg' => 'Lower Ground', | |
| 'g' => 'Ground', | |
| 'm' => 'Mezzanine', |
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
| // [council_tax_band] | |
| add_shortcode('council_tax_band', 'council_tax_band_shortcode'); | |
| function council_tax_band_shortcode($atts) { | |
| global $property; | |
| $council_tax_band = $property->council_tax_band; | |
| if ( !empty($council_tax_band) ) { | |
| return '<div class="council-tax-band">Council Tax Band: ' . esc_html($council_tax_band) . '</div>'; | |
| } else { |
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_plot_size', 10, 2 ); | |
| function import_plot_size($post_id, $property) | |
| { | |
| if ( isset($property->surface_area) && isset($property->surface_area->plot) && !empty($property->surface_area->plot) ) { | |
| update_post_meta( $post_id, '_plot_size', $property->surface_area->plot ); | |
| } | |
| } |
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_before_search_results_loop', 'add_view_shortlist_button', 50); | |
| function add_view_shortlist_button() { | |
| if ( isset($_GET['shortlisted']) && $_GET['shortlisted'] == '1' ) { | |
| echo '<div class="view-shortlist-container" style="clear: both;"> | |
| <a href="/search/" class="button view-shortlist-button">Back to Search</a> | |
| </div>'; | |
| } | |
| echo '<div class="view-shortlist-container" style="clear: both;"> | |
| <a href="/search/?shortlisted=1" class="button view-shortlist-button">View Shortlist</a> | |
| </div>'; |
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_vebra_api_xml", 'assign_student_let_type', 10, 2 ); | |
| function assign_student_let_type($post_id, $property) | |
| { | |
| $is_student = false; | |
| // Check conditions | |
| if ( isset($property->rm_let_type_id) && strtolower((string)$property->rm_let_type_id) == '3' ) { | |
| $is_student = true; | |
| } |
NewerOlder