You can assign locations to the map using programming. You need not to assign locations manually to the map from Add Map page. This hooks is very userful if you want to assign different locations on different pages.
add_filter('wpgmp_location_criteria','wpgmp_location_criteria',1,2);
function wpgmp_location_criteria($condition,$map) {
// modify condition here according to your requirement.
return $condition;
}
Code SnippetsYou can display different info window message for the posts according to page using this hook.
add_filter('wpgmp_infowindow_message', 'wpgmp_infowindow_message',1,2 ); function wpgmp_infowindow_message($message,$map) { //Modify Infowindow message for location. return $message; }Code Snippets
You can customize listing html displaying below google maps easily using this hook.
add_filter('wpgmp_listing_html', 'wpgmp_listing_html',1,2 ); function wpgmp_listing_html($listing_html,$map) { //Modify $listing_html according to your needs. return $listing_html; }Code Snippets
You can query posts to show posts on the google maps. You can use arguments mentioned here
add_filter('wpgmp_post_args', 'wpgmp_post_args',1,2 ); function wpgmp_post_args($args,$map) { //Modify arguments return $args; }Code Snippets
Modify separator used for multiple categories and tags using this hook. Default separator is comma (,).
add_filter('wpgmp_taxonomy_separator', 'wpgmp_taxonomy_separator',1,2 ); function wpgmp_taxonomy_separator($separator,$map) { //Modify separator here return $separator; }Code Snippets
You can easily customize featured image size using this hook.Default size is thumbnail.
add_filter('wpgmp_featured_image_size', 'wpgmp_featured_image_size',1,3 ); function wpgmp_featured_image_size($size,$post,$map) { /* You can specify image size in following formats //$size = 'thumbnail'; //$size = 'medium'; //$size = array(50,50); */ $size = 'medium'; return $size; }Code Snippets
You can modify img element containing featured image using this hook.
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. return $image; }Code Snippets
You can modify post’s data before display in the info window using this hook.
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; }Code Snippets
This hook is very useful if you want to load markers from external sources like database, API, JSON or xml files.
add_filter('wpgmp_marker_source','wpgmp_marker_source',1,2); function wpgmp_marker_source($markers,$map_id) { $markers = array(); $marker = array(); $marker['category'] = 'marker category'; // (optional) This is category name. $marker['id'] = '15987'; // (optional) Assign a numeric value to the marker. Make sure it's should be unique. $marker['title'] =" Marker Title"; // Assign a title to the marker. $marker['address'] =" Marker Address"; // Assign an address to the marker. $marker['message'] ="Info Window message"; // Show Infowindow message on marker click. $marker['latitude'] ="30.210994"; // Assign latitude to the marker. $marker['longitude'] ="74.94547450000005"; // Assign longitude to the marker. $marker['extra_fields'] = array('fax' => 123456, 'email' => 'hello@flippercode.com'); // You can add any number of extra fields and use proper placeholder to display in the info window or listing. $marker['icon'] ="https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"; // Assign an icon to the marker. $markers[] = $marker; return $markers; // Return array of markers. }Code Snippets
You can allow rendering shortcode using this hook.
add_filter('wpgmp_render_shortcode','wpgmp_render_shortcode',1,2 ); function wpgmp_render_shortcode($bool,$map) { //Default is TRUE. return $bool; }Code Snippets
You can show/hide a certain marker using this hook.
add_filter('wpgmp_show_place','wpgmp_show_place',1,3 ); function wpgmp_show_place($show,$place,$map) { //Default is TRUE return $show; }Code Snippets
This hook is very useful to process through all markers before displaying on the google maps.
add_filter('wpgmp_markers','wpgmp_markers',1,3 ); function wpgmp_markers($places,$map) { // $places is array of markers. return $places; }Code Snippets
This hook allows to add custom sorting options to sort location listing below the map. You can sort by
add_filter('wpgmp_sorting','wpgmp_sorting',1,2); function wpgmp_sorting($sorting,$map) { //Append your new sorting option here. return $sorting; }Code Snippets
You can allow rendering shortcode on the listing item using this hook.
add_filter('wpgmp_listing_render_shortcode','wpgmp_listing_render_shortcode',1,2 ); function wpgmp_listing_render_shortcode($bool,$map) { //Default is TRUE. return $bool; }
This hook allows to control all settings of listing below the google maps. You can easily show or hide listing controls and modify listing html using this hook.
add_filter('wpgmp_listing','wpgmp_listing',1,2 ); function wpgmp_listing($listing,$map) { //Modify listing settings using hook. return $listing; }Code Snippets
You can insert custom html before google maps container.
add_filter('wpgmp_before_map','wpgmp_before_map',1,2 ); function wpgmp_before_map($custom_html,$map) { return $custom_html; }Code Snippets
You can insert custom html after google maps container.
add_filter('wpgmp_after_map','wpgmp_after_map',1,2 ); function wpgmp_after_map($custom_html,$map) { return $custom_html; }Code Snippets
You can add custom css class to output container, consists of maps, filters and listing, to style it as you want.
add_filter('wpgmp_container_class','wpgmp_container_class',1,2 ); function wpgmp_container_class($class,$map) { return $css; }
You can add custom css class to google maps element to style it as you want.
add_filter('wpgmp_map_class','wpgmp_map_class',1,2 ); function wpgmp_map_class($class,$map) { return $css; }Code Snippets
You can insert custom html before shortcode output div.
add_filter('wpgmp_before_container','wpgmp_before_container',1,2 ); function wpgmp_before_container($custom_html,$map) { return $custom_html; }
You can insert custom html after shortcode output div.
add_filter('wpgmp_after_container','wpgmp_after_container',1,2 ); function wpgmp_after_container($custom_html,$map) { return $custom_html; }
This hook is very useful to change position of map and listing.
add_filter('wpgmp_map_output','wpgmp_map_output',1,4 ); 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. return $output; }Code Snippets
add_filter('wpgmp_update_default_placeholder','wpgmp_update_default_placeholder',10,1); function wpgmp_update_default_placeholder($placeholder_values){ $placeholder_values['search_placeholder'] = esc_html__('Enter school / university name here...','your-theme-textdomain-here'); return $placeholder_values; }