Skip to content

Instantly share code, notes, and snippets.

View wpflippercode's full-sized avatar

Sandeep Kumar wpflippercode

View GitHub Profile
@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: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: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: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: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:b649fea5cdeb1da74ad8c61dd5466c84
Created September 12, 2017 05:32
Hide Certain Markers on The Google Maps
add_filter('wpgmp_show_place','wpgmp_show_place',1,3 );
function wpgmp_show_place($show,$place,$map) {
// Here hide the marker with ID = 12665.
if($place['id'] == 12665) {
$show = FALSE;
}
return $show;
}
@wpflippercode
wpflippercode / gist:57c72a7e5adc2c7f0ee113756fcf360a
Created September 12, 2017 05:52
Show Markers on Google Maps According to Post ID in the WordPress
add_filter('wpgmp_markers','wpgmp_markers',1,3 );
function wpgmp_markers($places,$map) {
global $post;
if( $post->ID == 1 ) {
$places = array_slice($places, 1,10);
} else if ($post->ID == 2) {
$places = array_slice($places, 10,10);
} else {
@wpflippercode
wpflippercode / gist:13ef5cc21d797035490b93b430ae8074
Created September 13, 2017 07:03
Sort Locations Listing by City in Ascending & Decending Order
// Sort by city.
add_filter('wpgmp_sorting','wpgmp_sorting_location_field',2,2);
function wpgmp_sorting_location_field($sorting,$map) {
$sorting['city__asc'] ="City A-Z";
$sorting['city__desc'] ="City Z-A";
return $sorting;
}
@wpflippercode
wpflippercode / gist:e9b3ae79baa855a6a5271be42862e0db
Created September 13, 2017 07:04
Sort Location Listing by Extra Field Phone Number
// Sort by extra field. e.g "phone".
add_filter('wpgmp_sorting','wpgmp_sorting_extra_field',3,2);
function wpgmp_sorting_extra_field($sorting,$map) {
$sorting['phone__asc__num'] ="Phone A-Z";
$sorting['phone__desc__num'] ="Phone Z-A";
return $sorting;
}
@wpflippercode
wpflippercode / gist:fb1330ee49929a0b6e16a31358923346
Created September 13, 2017 07:05
Sort Posts Listing below google maps using custom field
// Sort by custom field. e.g "salary".
add_filter('wpgmp_sorting','wpgmp_sorting_custom_field',1,2);
function wpgmp_sorting_custom_field($sorting,$map) {
$sorting['%salary%__asc__num'] ="Salary Low-High";
$sorting['%salary%__desc__num'] ="Salary High-Low";
return $sorting;
}