Hooks for developers and ways of customization | wpmapspro.com

15000+ live websites are using this google maps wordpress plugin.

Hooks for Developers

– 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

– 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

– 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

– 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

– 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

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

        /* You can specify image size in following formats 
  	//$size = 'thumbnail';
  	//$size = 'medium';
  	//$size = array(50,50); */

        $size = 'medium';   
	return $size;
}
Code Snippets

– 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

– 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

– 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

– 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

– 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

– Loop through all markers before displaying on google maps.

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

– 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

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

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

– 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

– 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

– 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

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

– 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

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

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

– 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,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

– This filter is used to update the default text in frontend map listing and in the search & filter sections. Right now, by this example we’ve updated the default search box placeholder text. Using this same placeholder you can update every default text you see in the map / search / listing section.
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;
	
}

Install Plugin Now!

Buy this plugin exclusively on CodeCanyon! You’ll get free updates, full support, and if you’re not satisfied, we’ve got you covered with a 30-day money-back guarantee.