Skip to content

Instantly share code, notes, and snippets.

View wpflippercode's full-sized avatar

Sandeep Kumar wpflippercode

View GitHub Profile
@wpflippercode
wpflippercode / gist:19ac7a505564f203d58aa48985f813b5
Created September 12, 2017 05:22
Stop rendering Shortcode in the Infowindow Message
add_filter('wpgmp_render_shortcode','wpgmp_render_shortcode',1,2 );
function wpgmp_render_shortcode($bool,$map) {
//Default is TRUE.
$bool = FALSE;
return $bool;
}
@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:6277d9ed01cb42fca419e84ba307e82b
Created September 9, 2017 06:08
Show Full Post Content in the Infowindow on the Google Maps
add_filter('wpgmp_post_placeholder', 'wpgmp_post_placeholder',1,3 );
function wpgmp_post_placeholder($placeholders,$post,$map) {
// Posts Details
$placeholders['post_excerpt'] = get_the_content($post->ID);
return $placeholders;
}
@wpflippercode
wpflippercode / gist:462375a196c6d52a7ed3554b7b6b21be
Created September 9, 2017 05:33
Show random image in the infowindow message on the google maps
add_filter('wpgmp_featured_image', 'wpgmp_featured_image',1,3 );
function wpgmp_featured_image($image,$post_id,$map_id) {
// Modify img tag containing featured image.
$image = '<img src="http://lorempixel.com/400/200/" />';
return $image;
}
@wpflippercode
wpflippercode / gist:2818e079d9abe3e00dfbb6087f488729
Created September 9, 2017 05:12
Modify Featured Image Size in Info Window Message on Google Maps
add_filter('wpgmp_featured_image_size', 'wpgmp_featured_image_size',1,3 );
function wpgmp_featured_image_size($size,$post,$map) {
//$size = 'thumbnail';
//$size = 'medium';
$size = array(50,50);
return $size;
@wpflippercode
wpflippercode / gist:1c7e61d37edf22899dc1273d9ced90b9
Created September 9, 2017 05:04
Modify Categories & Tags Separator In the Info Window Message
add_filter('wpgmp_taxonomy_separator', 'wpgmp_taxonomy_separator',1,2 );
function wpgmp_taxonomy_separator($separtor,$map) {
$separtor = "|"; //default separator is comma (,)
return $separtor;
}
@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.
}
@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: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: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) {