Skip to content

Instantly share code, notes, and snippets.

@JoeHana
JoeHana / functions.php
Created December 4, 2019 13:58
Custom number of features in search form
<?php
/**
* Custom number of features in search form
*/
add_filter( 'wpsight_get_advanced_search_fields', 'custom_get_advanced_search_fields' );
function custom_get_advanced_search_fields( $fields ) {
$fields['feature']['data']['number'] = 20;
@JoeHana
JoeHana / functions.php
Last active June 25, 2019 14:18
Custom number of baths and beds in Listing Details
<?php
/**
* Custom number of baths and beds in Listing Details
*/
add_filter( 'wpsight_details', 'custom_wpsight_details' );
function custom_wpsight_details( $details ) {
@JoeHana
JoeHana / functions.php
Created January 15, 2019 00:10
An easy and simple way to show specific elements only to admins, by adding the class "only-admin" to it. Can be used with the menu manager, or elementor or whereever else a class can be defined.
add_action( 'wp_head', function() {
if( ! current_user_can( 'manage_options' ) )
echo '<style>.only-admin {display: none;}</style>';
});
@JoeHana
JoeHana / functions.php
Created December 5, 2018 17:17
Remove 'Details 1' and 'Details 2' from property search form in WPCasa
<?php
/**
* Remove 'Details 1' and 'Details 2' from property search form in WPCasa
*
* @param array Registered search fields
* @uses wpsight_details()
* @return array
*/
add_filter( 'wpsight_get_search_fields', 'custom_wpsight_get_search_fields' );
@JoeHana
JoeHana / functions.php
Created August 28, 2018 23:11
Set Featured Image & Title as default option in WPCasa Oslo
<?php
/**
* Set Featured Image & Title as default option in WPCasa Oslo
*/
add_filter( 'wpsight_oslo_meta_boxes_header_listings', 'custom_wpsight_oslo_meta_boxes_header_listings' );
function custom_wpsight_oslo_meta_boxes_header_listings( $fields ) {
@JoeHana
JoeHana / functions.php
Created March 9, 2018 11:06
Add custom taxonomy to search form
<?php
/**
* Add custom taxonomy to search form
*/
add_filter( 'wpsight_get_search_fields', 'custom_wpsight_get_search_fields' );
function custom_wpsight_get_search_fields( $fields ) {
@JoeHana
JoeHana / functions.php
Created November 30, 2017 15:43
Remove offer field and re-set spaces for remaining fields (for WPCasa Bahia)
<?php
/**
* Remove offer field and re-set spaces for remaining fields (for WPCasa Bahia)
*/
add_filter( 'wpsight_get_search_fields', 'custom_wpsight_bahia_get_search_field_widths' );
function custom_wpsight_bahia_get_search_field_widths( $fields ) {
// Unset offer
@JoeHana
JoeHana / functions.php
Created July 22, 2017 16:12
Remove 'Offer' from property search form in WPCasa (WPCasa Madrid, WPCasa Oslo, WPCasa London
<?php
/**
* Remove 'Offer' from property search form in WPCasa
* for Twitter's Bootstrap-based themes (WPCasa Madrid, WPCasa Oslo, WPCasa London)
*
* @param array Registered search fields
* @uses wpsight_details()
* @return array
*/
add_filter( 'wpsight_get_search_fields', 'wpsight_get_search_fields_offer_remove' );
@JoeHana
JoeHana / functions.php
Created July 22, 2017 16:09
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' );
@JoeHana
JoeHana / functions.php
Created July 21, 2017 14:20
Set specific offer as default in listing price metabox
<?php
/**
* Set specific offer as default in listing price metabox
*/
add_filter( 'wpsight_meta_box_listing_price_fields', 'custom_wpsight_meta_box_listing_price_fields', 10 );
function custom_wpsight_meta_box_listing_price_fields( $fields ) {
$fields['offer']['default'] = 'rent';
return $fields;