Skip to content

Instantly share code, notes, and snippets.

View wpflippercode's full-sized avatar

Sandeep Kumar wpflippercode

View GitHub Profile
@wpflippercode
wpflippercode / gist:ee4a168ead51d9c30595314e439327e8
Created September 16, 2017 06:37
Arrange position of map and listing using hook
add_filter('wpgmp_map_output','wpgmp_map_output',1,3 );
function wpgmp_map_output($output,$map_div,$listing_div,$map_id) {
// You can use $map_div and $listing_div to place them according to your need.
$output = "<div style='float:right'>".$map_div."</div>";
$output .= "<div style='float:left'>".$listing_div."</div>";
return $output;
}
@wpflippercode
wpflippercode / gist:6c9aa8d02d52201fc63b87b6c7dffd85
Created December 2, 2016 13:30
Remove Profile Picture section on Edit Profile Page
add_action('admin_head','fc_remove_profile_image');
function fc_remove_profile_image(){
echo '<script>
jQuery(document).ready(function(){
jQuery("tr.user-profile-picture").remove();
});
</script>';
@wpflippercode
wpflippercode / gist:bc2eb104cc0250a2b66187e54f5327ad
Created July 3, 2017 12:15
Change Google Maps Zoom Level According to Page
add_filter('wpgmp_maps_options','wpgmp_maps_options',2,1);
function wpgmp_maps_options($options,$map) {
//Here You can change zoom level according to the page.
if(is_home()) {
$options['zoom'] = 10;
} else if ( is_page('map-locator') ) {
$options['zoom'] = 15;
}
return $options;
}
@wpflippercode
wpflippercode / gist:1293f805f532494e0b8d5dc05caef749
Created September 8, 2017 06:55
Modify Info Window Contents for Posts Using Hook
add_filter('wpgmp_infowindow_post_message', 'wpgmp_infowindow_post_message',1,2 );
function wpgmp_infowindow_post_message($message,$map) {
global $post;
//This will apply for map id 1.
if( $post->ID == 1) {
$message = "<h1>{marker_title}</h1>";
}
if( $post->ID == 107) {
@wpflippercode
wpflippercode / gist:f94dee4927d24e771e2c8670cea84b32
Created September 8, 2017 06:35
Limit Number of Markers on the google maps
add_filter('wpgmp_location_criteria', 'wpgmp_location_criteria',1,2 );
function wpgmp_location_criteria($location_criteria,$map) {
//This will apply for map id 1.
if( $map->map_id == 1) {
$location_criteria['limit'] = 5;
}
return $location_criteria;
@wpflippercode
wpflippercode / gist:7044871fb20bcf05ca030e5f8ad05b63
Created January 21, 2019 13:03
Change Marker Cluster Icon Using Filter
add_filter('wpgmp_map_markercluster',change_cluster_marker,10,2);
function change_cluster_marker($cluster_data,$map){
// Add map specific condition here
if($map->map_id == '1'){
//Change Main Cluster Image
$cluster_data['icon'] = 'university.png';
@wpflippercode
wpflippercode / gist:c920b59f4eee6c8edead58a2c96dd5c5
Created September 9, 2017 07:11
Show Markers on the Google Maps Using Remote JSON File
add_filter('wpgmp_marker_source','wpgmp_marker_source',1,2);
function wpgmp_marker_source($markers,$map_id) {
/* You can create array of the markers to add on the google maps dynamically. It's very useful hook if you want to fetch
locations from an external database, API, JSON or XML.
*/
$markers = array();
@wpflippercode
wpflippercode / gist:0b119ae1b6714b3e9657356adac70410
Created May 26, 2018 04:42
Access Map Object Using Javascript
add_action("wp_head","fc_reset_zoom");
function fc_reset_zoom() {
echo '
<script>jQuery(document).ready(function($){ alert("ok");
$("body").on("click",".test",function(){ var map_obj = $("#map5").data("wpgmp_maps"); map_obj.map.setZoom(8); }
@wpflippercode
wpflippercode / gist:97ea3c89de11d2e3ba72e36c6e1c0de0
Created May 16, 2018 13:48
Verify Cookies Consent Before Showing the Google Maps
add_filter('wpgmp_accept_cookies','wpgmp_accept_cookies');
function wpgmp_accept_cookies($is_allowed) {
// cookies-notice plugin integration -
if( function_exists('cn_cookies_accepted') ) {
$is_allowed = cn_cookies_accepted();
}
// cookies-consent plugin integration. You may change cookie name here according to your needs.
@wpflippercode
wpflippercode / gist:b02e04871fe823d1b71bb04993cc153e
Created November 27, 2017 09:45
Show Current Post Marker only on the Google Maps
add_filter('wpgmp_show_place','wpgmp_show_place',1,3 );
function wpgmp_show_place($show,$place,$map) {
global $post;
if($place['id'] != $post->ID) {
$show = FALSE;
}
return $show;
}