Skip to content

Instantly share code, notes, and snippets.

Avatar

Sandeep Kumar wpflippercode

View GitHub Profile
View gist:41ad368360d2d140da4a253d11e7cd28
add_filter('wpgmp_location_criteria','wpgmp_location_criteria',1,2 );
function wpgmp_location_criteria($criteria,$map) {
$criteria['show_all_locations'] = true;
return $criteria;
}
@wpflippercode
wpflippercode / gist:18f9b3a1205af57b7e7d92b9a0d0fdd8
Created Jun 16, 2017
Set Minimum Age By Category in Age Gate WordPress Plugin
View gist:18f9b3a1205af57b7e7d92b9a0d0fdd8
add_filter('agp_current_settings', 'agp_current_settings',1,1);
function agp_current_settings($options) {
if(is_category('beer')) {
$options['min_age'] = 16;
} elseif(is_category('spirits')) {
$options['min_age'] = 18;
}
@wpflippercode
wpflippercode / gist:b2a88cdfd88b7332112e2f650f86439b
Created Jun 20, 2017
Show Single Post's Location on the Map on single post page.
View gist:b2a88cdfd88b7332112e2f650f86439b
<?php
$CURRENTPOST_LAT = get_post_meta(get_the_ID(),'_wpgmp_metabox_latitude',true);
$CURRENTPOST_LON = get_post_meta(get_the_ID(),'_wpgmp_metabox_longitude',true);
echo do_shortcode("[display_map marker1='$CURRENTPOST_LAT | $CURRENTPOST_LON | hello world | Bla Bla | category']");
?>
@wpflippercode
wpflippercode / gist:d59d0e7d8986b7f008acb484c8628477
Last active Sep 8, 2017
Show Locations by Category on the google maps
View gist:d59d0e7d8986b7f008acb484c8628477
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['show_all_locations'] = true;
$location_criteria['category__in'] = array(1,2,3); // You can use category name as well.
}
return $location_criteria;
@wpflippercode
wpflippercode / gist:90ec9cfb90784dca85726c669a339967
Created Sep 8, 2017
Show all Locations on the google maps without assigning them to the map manually.
View gist:90ec9cfb90784dca85726c669a339967
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['show_all_locations'] = true;
}
return $location_criteria;
@wpflippercode
wpflippercode / gist:4bb2cd13c6a26a08ec2a642a3c96b872
Created Sep 8, 2017
Show Locations on the maps by exlcuding certain categories.
View gist:4bb2cd13c6a26a08ec2a642a3c96b872
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['show_all_locations'] = true;
$location_criteria['category__not_in'] = array(1,2); // You can use category name as well.
}
return $location_criteria;
@wpflippercode
wpflippercode / gist:8f7700f850a891cfc4c491fc3e568aed
Created Sep 8, 2017
Modify Info Window Message Page Wise.
View gist:8f7700f850a891cfc4c491fc3e568aed
add_filter('wpgmp_infowindow_message', 'wpgmp_infowindow_message',1,2 );
function wpgmp_infowindow_message($message,$map) {
global $post;
if( $post->ID == 1) {
$message = "<h1>{marker_title}</h1>";
}
if( $post->ID == 2) {
@wpflippercode
wpflippercode / gist:2a905150696ff565f6a48484860cc5b7
Created Sep 8, 2017
Modify Listing HTML below Google Maps Using Hook
View gist:2a905150696ff565f6a48484860cc5b7
add_filter('wpgmp_listing_html', 'wpgmp_listing_html',1,2 );
function wpgmp_listing_html($listing_html,$map) {
$listing_html = "<div class='listing_item'><h3>{marker_title}</h3> <p>{marker_message}</p></div>";
return $listing_html;
}
@wpflippercode
wpflippercode / gist:d0cab9c448c2f744612b21b217efa443
Last active Sep 8, 2017
Change map's zoom level according to page type.
View gist:d0cab9c448c2f744612b21b217efa443
add_filter('wpgmp_maps_options', 'wpgmp_maps_options',1,2 );
function wpgmp_maps_options($map_settings,$map) {
global $post;
if(is_front_page()) {
$map_settings['zoom'] = 15;
} else if(is_single()) {
$map_settings['zoom'] = 10;
@wpflippercode
wpflippercode / gist:7321063f2b1fcdd612c34b9a93ab195f
Created Sep 9, 2017
Show Posts of a specific category on the google maps
View gist:7321063f2b1fcdd612c34b9a93ab195f
add_filter('wpgmp_post_args', 'wpgmp_post_args',1,2 );
function wpgmp_post_args($args,$map) {
global $post;
if(is_category(1)) {
$args['category__in'] = 1; // Show Posts of Category ID = 1 on the google maps.
}