Skip to content

Instantly share code, notes, and snippets.

add_action( 'propertyhive_after_search_results_loop_item_title', 'jons_propertyhive_search_address', 7 );
add_action( 'propertyhive_after_search_results_loop_item_title', 'jons_propertyhive_search_bedrooms', 8 );
function jons_propertyhive_search_address() {
?>
<div class="address">
<?php echo $property->get_formatted_full_address(); ?>
</div>
<?php
}
// Logo Block
function getCustomLogo() {
// set empty return value
$logo = get_option('header_logo');
if ($logo !== FALSE) {
$logo_url = wp_get_attachment_url($logo);
if( $logo_url !== FALSE ) {
return $logo_url;
}
}
<?php
/**
* Loop Summary
*
* @author PropertyHive
* @package PropertyHive/Templates
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php
$args = array(
'post_type' => 'property',
'post_status' => 'publish',
'nopaging' => true,
'orderby' => 'rand',
'meta_query' => array(
array(
'key' => '_on_market',
<?php
/**
* Single Property title
*
* @author PropertyHive
* @package PropertyHive/Templates
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
add_action( 'template_redirect', 'default_search_form_to_lettings' );
function default_search_form_to_lettings()
{
global $post;
if ($post->ID == 2) // REPLACE '2' WITH THE PAGE ID OF YOUR LETTINGS PAGE
{
$_GET['department'] = 'residential-lettings';
}
}
@propertyhive
propertyhive / gist:68949f1f62600a6257792ef7a9485881
Created September 2, 2016 11:05
Add lettings fees textarea to property record
// Add lettings fees box to property
add_action( 'propertyhive_property_residential_lettings_details_fields', 'add_lettings_fees_box_to_property' );
function add_lettings_fees_box_to_property()
{
// Available Date
propertyhive_wp_textarea_input( array(
'id' => '_lettings_fees',
'label' => __( 'Lettings Fees', 'propertyhive' ),
'desc_tip' => false
) );
@propertyhive
propertyhive / gist:ca8ad83260a069dbe62630ee42eb124d
Created September 2, 2016 11:36
Amend Rightmove request pre-send
// Add lettings fees on property to RTDF feed
add_filter( 'ph_rtdf_send_request_data', 'add_property_lettings_fees_to_rtdf_feed', 10, 2 );
function add_property_lettings_fees_to_rtdf_feed( $request_data, $post_id )
{
$property_lettings_fees = get_post_meta( $post_id, '_lettings_fees', TRUE );
if ($property_lettings_fees != '')
{
$request_data['property']['price_information']['administration_fee'] = $property_lettings_fees;
}
@propertyhive
propertyhive / gist:c341b812406634bbc2a0a75b59795d72
Last active March 14, 2019 14:09
Add custom validation to property
add_action( 'propertyhive_property_address_fields', 'add_property_address_validation' );
function add_property_address_validation()
{
?>
<script>
jQuery('.wrap form').submit(function()
{
if (jQuery(this).find('input[name=\'_address_three\']').val() == '')
{
@propertyhive
propertyhive / gist:a4a1573a018fe3e48b370f043137527d
Created September 8, 2016 14:19
Add featured image support to properties
add_filter( 'propertyhive_register_post_type_property', 'add_featured_image_to_properties' );
function add_featured_image_to_properties($property_post_type_args = array())
{
$property_post_type_args['supports'][] = 'thumbnail';
return $property_post_type_args;
}
add_theme_support( 'post-thumbnails' ); // this line might not be needed, depending on your theme