Skip to content

Instantly share code, notes, and snippets.

@propertyhive
propertyhive / php
Last active March 23, 2016 13:26
Add location field to PropertyHive search form
add_filter( 'propertyhive_search_form_fields_default', 'update_ph_search_form_fields', 10, 1 );
function update_ph_search_form_fields($fields)
{
$department_field = $fields['department'];
unset( $fields['department'] );
$fields = array_reverse($fields, true);
$fields['address_keyword'] = array(
'type' => 'text',
@propertyhive
propertyhive / gist:e437dd2465430c7cfce014f610f2f2bc
Last active June 15, 2016 14:23
Display map on Property Hive full details page
<div id="map_canvas" style="height:300px"></div>
<script src="http://maps.google.com/maps/api/js"></script>
<script>
var map; // Global declaration of the map
function initialize_map() {
@propertyhive
propertyhive / gist:6e2025af2687060553792661d0c0b2a5
Created July 1, 2016 09:49
Lobster Web Design Property Hive Search Form
add_filter( 'propertyhive_search_form_fields_shortcode', 'edit_property_search_form_shortcode_fields', 1, 1 );
function edit_property_search_form_shortcode_fields($form_fields)
{
// Change the labels from 'Sales' and 'Lettings' to 'Buy' and 'Rent'
$form_fields['department']['options']['residential-sales'] = 'Buy';
$form_fields['department']['options']['residential-lettings'] = 'Rent';
$form_fields['address_keyword'] = array(
'type' => 'text',
'show_label' => false,
<?php
/**
* Single Property Images
*
* @author PropertyHive
* @package PropertyHive/Templates
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php
/**
* Loop Summary
*
* @author PropertyHive
* @package PropertyHive/Templates
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
<?php
/**
* Make enquiry action, plus lightbox form
*
* @author PropertyHive
* @package PropertyHive/Templates
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@propertyhive
propertyhive / gist:25eec5c55ea123a305d387b79367c2ad
Last active December 11, 2020 12:47
Set Student Property in RTDF
add_filter( 'ph_rtdf_send_request_data', 'set_as_student_property', 10, 2 );
function set_as_student_property( $request_data, $post_id )
{
$request_data['property']['student_property'] = true;
return $request_data;
}
add_filter( 'ph_zoopla_rtdf_send_request_data', 'set_as_student_property_zoopla', 10, 2 );
function set_as_student_property_zoopla( $request_data, $post_id )
add_action( 'propertyhive_property_query', 'custom_field_property_filter' );
function custom_field_property_filter( $q ){
global $post;
if (is_post_type_archive( 'property' ))
{
if ( isset($_GET['my_field']) && $_GET['my_field'] != '' ) // YOUR CRITERIA HERE
{
$meta_query = $q->get( 'meta_query' );
@propertyhive
propertyhive / gist:5d017385cc7dbd844616818889258e1b
Created July 25, 2016 14:41
Russell Map View Followed by List
add_action( 'init', 'show_map_by_default', 1 );
function show_map_by_default()
{
$_GET['view'] = 'map';
}
add_action( 'init', 'maintain_property_list', 1 );
function maintain_property_list()
{
add_filter( 'propertyhive_show_results', create_function( '', 'return true;' ), 10 );
<?php
/**
* Loop Price
*
* @author PropertyHive
* @package PropertyHive/Templates
* @version 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly