JoeHana
7/22/2017 - 4:09 PM

Remove 'Offer' from property search form in WPCasa

Remove 'Offer' from property search form in WPCasa

<?php
/**
 *	Remove 'Offer' from property search form in WPCasa
 *
 *	@param	array	Registered search fields
 *	@uses	wpsight_details()
 *	@return	array
 */
add_filter( 'wpsight_get_search_fields', 'wpsight_get_search_fields_offer_remove' );

function wpsight_get_search_fields_offer_remove( $fields ) {
	
	// Unset offer
	unset( $fields['offer'] );
	
	/**
	 * As we removed a field, we need to adjust the width
	 * of the other fields in the same row.
	 */
	
	// Get listing details
	$details = wpsight_details();
	
	$details_1 = $details['details_1']['id'];
	$details_2 = $details['details_2']['id'];
	
	$fields['location']['class'] = 'width-1-4';
	$fields['listing-type']['class'] = 'width-1-4';
	$fields[ $details_1 ]['class'] = 'width-1-4';
	$fields[ $details_2 ]['class'] = 'width-1-4';
	
	return $fields;
	
}