wpCasa: Remove Maps Feature (WPSC50)
<?php
/**
* Early Init (to initialize certain actions)
*/
add_action('init', 'wpsc50_remove_maps');
function wpsc50_remove_maps() {
// disable loading of the gmaps scripts
remove_theme_support('gmaps');
// removes listing location metabox in the listing editor
remove_theme_support( 'listing-location' );
}
/**
* Modify the inclusion of the Map Feature on certain pages.
*/
add_filter('wpsight_place_listing_search_map', 'wpsc50_place_listing_search_map');
function wpsc50_place_listing_search_map() {
// choose where to include/exclude the maps feature.
// Possible values: true or false
$map_show = array(
'search' => false,
'tax_location' => false,
'tax_feature' => false,
'tax_type' => false,
'tax_category' => false,
'templates' => false,
'author' => false,
'archive' => false,
'favorites' => false
);
if( $map_show['search'] && is_search() && ! isset( $_GET['stype'] ) ) {
$show = true;
} elseif( $map_show['tax_location'] && is_tax( 'location' ) ) {
$show = true;
} elseif( $map_show['tax_feature'] && is_tax( 'feature' ) ) {
$show = true;
} elseif( $map_show['tax_type'] && ( is_tax( 'listing-type' ) || is_tax( 'property-type' ) ) ) {
$show = true;
} elseif( $map_show['tax_category'] && ( is_tax( 'listing-category' ) || is_tax( 'property-category' ) ) ) {
$show = true;
} elseif( $map_show['templates'] && ( is_page_template( 'page-tpl-listings.php' ) || is_page_template( 'page-tpl-properties.php' ) ) ) {
$show = true;
} elseif( $map_show['archive'] && is_post_type_archive( wpsight_listing_post_type() ) ) {
$show = true;
} elseif( $map_show['author'] && is_author() ) {
$show = true;
} elseif( $map_show['favorites'] && is_page_template( 'page-tpl-favorites.php' ) ) {
$show = true;
} else {
$show = false;
}
return $show;
}