Skip to content

Instantly share code, notes, and snippets.

add_action( "propertyhive_property_imported_blm", 'set_inv_dept', 10, 2 );
function set_inv_dept($post_id, $property)
{
$investment = false;
for ( $i = 1; $i <= 10; ++$i )
{
if (
isset($property['FEATURE' . $i]) &&
strpos( strtolower(trim($property['FEATURE' . $i])), 'investment' ) !== FALSE
@propertyhive
propertyhive / gist:f8652641b9b2ee14ae9ad28721c812a6
Created May 8, 2024 11:13
Output Houzez images stored as URLs
function houzez_get_property_gallery($size = 'thumbnail')
{
global $post;
if ( ! houzez_option('disable_property_gallery', 1) ) {
return;
}
if ( get_post_meta($post->ID, 'images_stored_as_urls', true) === '1' )
{
@propertyhive
propertyhive / gist:1f23277c32203114d0c304eeba2f0ea5
Created May 8, 2024 05:07
Add ability to order by property address name/number
add_filter( 'propertyhive_results_orderby', 'add_name_order' );
function add_name_order( $orders )
{
$orders['address_name_number-asc'] = 'Name - Low To High';
$orders['address_name_number-desc'] = 'Name - High To Low';
return $orders;
}
add_filter( 'propertyhive_get_search_results_ordering_args', 'order_by_name' );
function order_by_name($args)
add_action( "propertyhive_property_imported_blm", "set_exempt_custom_field", 10, 2 );
function set_exempt_custom_field($post_id, $property)
{
if ( isset($property['COUNCIL_TAX_EXEMPT']) && $property['COUNCIL_TAX_EXEMPT'] == '1' )
{
update_post_meta( $post_id, '_council_tax_exempt', 'Yes' );
}
else
{
update_post_meta( $post_id, '_council_tax_exempt', 'No' );
function screddit_filter_single_elementor_template($manager)
{
if (ElementorPro\Modules\ThemeBuilder\Module::is_preview()) // Do not change content when editing.
return;
$theme_builder = ElementorPro\Modules\ThemeBuilder\Module::instance();
$current_template = $theme_builder->get_conditions_manager()->get_documents_for_location('single');
if (is_singular('property')) {
add_action( 'elementor/query/investmentquery', 'elementor_query_investment_only' );
function elementor_query_investment_only( $query )
{
PH()->query->property_query( $query );
// Set the custom post type
$query->set( 'post_type', [ 'property' ] );
$tax_query = $query->get('tax_query');
@propertyhive
propertyhive / gist:852b6d9ed9edf4e1f918197d6c4d0c4a
Created May 7, 2024 08:57
Store images as URLs in Houzez Property Feed
add_filter('houzez_property_feed_images_stored_as_urls', 'stores_media_urls', 10, 4);
function stores_media_urls($stored_as_urls, $post_id, $property, $import_id)
{
return true;
}
add_action( "propertyhive_property_imported_vebra_api_xml", "correct_property_auction_department", 10, 2 );
function correct_property_auction_department($post_id, $property)
{
$price_attributes = $property->price->attributes();
if ( isset($price_attributes['qualifier']) && strpos(strtolower($price_attributes['qualifier']), 'auction') !== false )
{
update_post_meta( $post_id, '_department', 'auction' );
}
}
function screddit_filter_single_elementor_template($manager)
{
if (ElementorPro\Modules\ThemeBuilder\Module::is_preview()) // Do not change content when editing.
return;
$theme_builder = ElementorPro\Modules\ThemeBuilder\Module::instance();
$current_template = $theme_builder->get_conditions_manager()->get_documents_for_location('single');
if (is_singular('property')) {
function custom_rewrite_basic() {
// The following rule maps /locations/east/ to the search results page with a specific location ID
add_rewrite_rule('^locations/east/?$', 'index.php?pagename=search_results&location=241', 'top');
}
add_action('init', 'custom_rewrite_basic');
function register_query_vars( $vars ) {
$vars[] = 'location'; // Add 'location' to the recognized query vars
return $vars;
}