Download GDPR Compliance WordPress Plugin in Just $9 Today.

Hooks

Hooks

This google maps plugin for wordpress is developer friendly. Developers can control on various aspect of this plugin using hooks. Below are the userful hooks provided in this plugin.

wpgmp_location_criteria

– Use this hook to assign locations to the map.

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 Snippets

wpgmp_infowindow_message

– Modify content of the info window message for the post.

You 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

wpgmp_listing_html

– Modify listing html below google maps.

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

wpgmp_post_args

– Query posts to show posts on google maps.

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

wpgmp_taxonomy_separator

– Modify separator used for multiple categories and tags.

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

wpgmp_featured_image_size

– Modify featured image size displaying in info window message or listing.

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) {

  	//$size = 'thumbnail';
  	//$size = 'medium';
  	//$size = array(50,50);

//setup featured image size here.

	return $size;
}

Code Snippets

wpgmp_featured_image

– Modify img element containing featured image.

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

wpgmp_post_placeholder

– Modify post’s information before display in the info window or listing.

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

wpgmp_marker_source

– Load markers on the google maps usign external sources.

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

wpgmp_render_shortcode

– Allow to render shortcode in the infowindow message.

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

wpgmp_show_place

– Show/Hide individual marker.

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

wpgmp_markers

– Loop through all markers before displaying on google maps.

This hook is very userful 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

wpgmp_sorting

– Add sorting option in the Sort filter to sort locations listing.

This hook allows to add custom sorting options to sort location listing below the map. You can sort by location fields, extra fields added to the location or custom fields of the post.

add_filter('wpgmp_sorting','wpgmp_sorting',1,2);
function wpgmp_sorting($sorting,$map) {
//Append your new sorting option here.
return $sorting;
}


Code Snippets

wpgmp_listing_render_shortcode

– Allow to render shortcode in the listing below maps.

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;
}
wpgmp_listing

– Control All settings of Listing below google maps.

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

wpgmp_before_map

– Insert custom html before google maps container.

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

wpgmp_after_map

– Insert custom html after google maps container.

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

wpgmp_container_class

– Add css class to shortcode output container div.

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;
}
wpgmp_map_class

– Add css class to google maps element div.

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

wpgmp_before_container

– Add custom html before shortcode output div.

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;
}
wpgmp_after_container

– Add custom html after shortcode output div.

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;
}
wpgmp_map_output

– Arrange position of map and listing.

This hook is very useful to change position of map and listing.

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.
return $output;

}

Code Snippets