Skip to content

Instantly share code, notes, and snippets.

View wpflippercode's full-sized avatar

Sandeep Kumar wpflippercode

View GitHub Profile
@wpflippercode
wpflippercode / gist:41ad368360d2d140da4a253d11e7cd28
Created April 25, 2017 09:34
Show All Locations on The Map
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 June 16, 2017 11:55
Set Minimum Age By Category in Age Gate WordPress Plugin
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 June 20, 2017 04:41
Show Single Post's Location on the Map on single post page.
<?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 September 8, 2017 05:38
Show Locations by Category 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['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 September 8, 2017 05:43
Show all Locations on the google maps without assigning them to the map manually.
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 September 8, 2017 05:49
Show Locations on the maps by exlcuding certain categories.
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 September 8, 2017 06:47
Modify Info Window Message Page Wise.
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 September 8, 2017 07:00
Modify Listing HTML below Google Maps Using Hook
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 September 8, 2017 07:13
Change map's zoom level according to page type.
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 September 9, 2017 04:45
Show Posts of a specific category on the google maps
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.
}