Skip to content

Instantly share code, notes, and snippets.

Avatar

Sandeep Kumar wpflippercode

View GitHub Profile
@wpflippercode
wpflippercode / gist:ee4a168ead51d9c30595314e439327e8
Created Sep 16, 2017
Arrange position of map and listing using hook
View gist:ee4a168ead51d9c30595314e439327e8
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 Dec 2, 2016
Remove Profile Picture section on Edit Profile Page
View gist:6c9aa8d02d52201fc63b87b6c7dffd85
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 Jul 3, 2017
Change Google Maps Zoom Level According to Page
View gist:bc2eb104cc0250a2b66187e54f5327ad
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 Sep 8, 2017
Modify Info Window Contents for Posts Using Hook
View gist:1293f805f532494e0b8d5dc05caef749
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 Sep 8, 2017
Limit Number of Markers on the google maps
View gist:f94dee4927d24e771e2c8670cea84b32
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 Jan 21, 2019
Change Marker Cluster Icon Using Filter
View gist:7044871fb20bcf05ca030e5f8ad05b63
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 Sep 9, 2017
Show Markers on the Google Maps Using Remote JSON File
View gist:c920b59f4eee6c8edead58a2c96dd5c5
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();
View gist:0b119ae1b6714b3e9657356adac70410
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
Verify Cookies Consent Before Showing the Google Maps
View gist:97ea3c89de11d2e3ba72e36c6e1c0de0
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 Nov 27, 2017
Show Current Post Marker only on the Google Maps
View gist:b02e04871fe823d1b71bb04993cc153e
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;
}