Skip to content

Instantly share code, notes, and snippets.

View wpflippercode's full-sized avatar

Sandeep Kumar wpflippercode

View GitHub Profile
@wpflippercode
wpflippercode / gist:ee4a168ead51d9c30595314e439327e8
Created September 16, 2017 06:37
Arrange position of map and listing using hook
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:56b1d7853cd7fede2ec58a9a0495b1b9
Created September 14, 2017 07:39
Insert custom html after google maps container
add_filter('wpgmp_after_map','wpgmp_after_map',1,2 );
function wpgmp_after_map($custom_html,$map) {
$custom_html = "<p class='map-description'>Insert custom html after google maps.</p>";
return $custom_html;
}
@wpflippercode
wpflippercode / gist:4c40add5b384b5d71b1c2d82e20fe95b
Last active September 14, 2017 07:35
Add custom css class to google maps container div
add_filter('wpgmp_map_container_class','wpgmp_map_container_class',1,2);
function wpgmp_map_container_class($class,$map) {
$class="custom_map_css";
return $class;
}
@wpflippercode
wpflippercode / gist:1e6581c5805adde80427dd8a078b3d05
Created September 14, 2017 07:14
Add custom html before google maps container.
add_filter('wpgmp_before_map','wpgmp_before_map',1,2 );
function wpgmp_before_map($section,$map) {
$section = "<p class='map-description'>Use below map to visit our offices and search nearby office.</p>";
return $section;
}
@wpflippercode
wpflippercode / gist:cb28ef05d260b8fe5ed5062453fa33ac
Created September 14, 2017 06:15
Modify Location Listing below Google Maps using Hook
add_filter('wpgmp_listing','wpgmp_listing',1,2 );
function wpgmp_listing($listing,$map) {
$listing['listing_placeholder'] = "<div class='listing-item'><h4>{marker_title}</h4><p>{marker_address}</p></div>";
return $listing;
}
@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;
}
@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: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: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: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;
}