Skip to content

Instantly share code, notes, and snippets.

add_action( 'elementor/query/onmarketpropertyquery', 'remove_sold_from_elementor_query', 99 );
function remove_sold_from_elementor_query( $query )
{
$tax_query = $query->get('tax_query');
$tax_query[] = array(
'taxonomy' => 'availability',
'terms' => array(15),
'operator' => 'NOT IN',
);
add_filter( 'propertyhive_property_query_tax_query', 'remove_sold', 10, 2 );
function remove_sold( $tax_query, $query )
{
$tax_query[] = array(
'taxonomy' => 'availability',
'terms' => array(15),
'operator' => 'NOT IN',
);
return $tax_query;
add_filter( 'kadence_blocks_pro_query_loop_query_vars', function( $query, $ql_query_meta, $ql_id ) {
// Change XXXX accordingly to QL ID.
// It looks like you can find this by navigating to 'Kadence Blocks > All Queries'
if ( $ql_id == XXXX )
{
$query['tax_query'] = array(
array(
'taxonomy' => 'property_type',
'field' => 'slug',
@propertyhive
propertyhive / gist:99788e07880d5090bf7a5d89da2efdd3
Created July 16, 2024 13:11
Put property media into it's own uploads directory
function custom_upload_dir($uploads) {
if (isset($_REQUEST['post_id'])) {
$post_id = (int) $_REQUEST['post_id'];
$post = get_post($post_id);
if ($post && $post->post_type == 'property') {
$subdir = '/property';
// Modify the upload directory paths
$uploads['subdir'] = $subdir;
@media (max-width:767px) {
.propertyhive ul.properties li .thumbnail { float:none; width:100%; margin-bottom:20px; }
.propertyhive ul.properties li .details { float:none; width:100% }
}
add_filter( 'propertyhive_single_property_meta', 'add_location_to_meta' );
function add_location_to_meta( $meta )
{
global $property;
$location = $property->location;
if ( $location != '' )
{
$meta['location'] = array(
add_filter('propertyhive_property_query_meta_query', 'remove_department_constraint', 10, 2);
function remove_department_constraint( $meta_query, $q )
{
$new_meta_query = array();
foreach ( $meta_query as $query )
{
if ( !isset($query['key']) || (isset( $query['key']) && $query['key'] != '_department') )
{
$new_meta_query[] = $query;
add_action( "propertyhive_property_imported_rex_json", 'rex_import_stuff', 10, 2 );
function rex_import_stuff($post_id, $property)
{
if ( isset($property['listing_agent_1']['name']) && $property['listing_agent_1']['name'] != '' )
{
$args = array(
'post_type' => 'agent',
's' => $property['listing_agent_1']['name'],
'posts_per_page' => 1
);
@propertyhive
propertyhive / gist:80698d32208bf487deeb9a50a902e5b2
Last active July 12, 2024 09:56
Move Council Tax Band from features to description in Reapit/Jet imports
add_action( "propertyhive_property_imported_jet", 'move_ctb_to_descriptions', 10, 2 );
function move_ctb_to_descriptions($post_id, $property)
{
$council_tax_description = '';
// Remove from features
$features = array();
if ( isset($property->AccommodationSummary) && is_array($property->AccommodationSummary) && !empty($property->AccommodationSummary) )
{
add_filter( 'propertyhive_user_details_form_fields', 'split_out_tel_in_reg_form' );
function split_out_tel_in_reg_form($fields)
{
// Step 1: Split the array at the position where the new element needs to be inserted
$position = array_search('telephone_number', array_keys($fields));
$before = array_slice($fields, 0, $position, true);
$after = array_slice($fields, $position, null, true);
// Step 2: Define the new element
$new_element = array(