{"id":482,"date":"2026-04-26T18:33:04","date_gmt":"2026-04-26T18:33:04","guid":{"rendered":"https:\/\/docs.joedolson.com\/my-calendar-pro\/?p=482"},"modified":"2026-04-26T18:33:08","modified_gmt":"2026-04-26T18:33:08","slug":"geolocation","status":"publish","type":"post","link":"https:\/\/docs.joedolson.com\/my-calendar-pro\/geolocation\/","title":{"rendered":"Geolocation"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">My Calendar Pro includes geolocation features for finding venues. Development is in progress to extend this to finding events.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are a few prerequisites to being able to use the geolocation features, due to the data and API dependencies.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Services Used<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Geolocation features use the <a href=\"https:\/\/www.maxmind.com\/en\/geoip-databases\">MaxMind GeoLite IP to City<\/a> database for translating a user&#8217;s IP to a general location and the <a href=\"https:\/\/developers.google.com\/maps\/documentation\/javascript\/get-api-key\">Google Maps API<\/a> for translating address information to geographical coordinates. This database is <em>optional<\/em>; see the shortcode set up for more information.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can obtain the free version of the GeoLite IP to City database by setting up an account and submitting a request.The form can be difficult to find. At the time I&#8217;m writing, you can <a href=\"https:\/\/www.maxmind.com\/en\/geolite2\/signup\">sign up for the GeoLite database services at this link<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With the Google Maps API, you cannot use their &#8216;referer&#8217; IP usage restrictions, as the geocoding API does not work with those restrictions in place.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where to put the Database<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The database you download is expected to be a file with the name <code>GeoLite2-City.mmdb<\/code>. My Calendar Pro expects to find it at <code>\/wp-content\/my-calendar-custom\/db\/GeoLite2-City.mmdb<\/code>. This is the common directory for adding custom files for My Calendar. The file name and path can be changed using the <code>mcs_geolocate_db_filepath<\/code> filter.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to enable GeoLocation features<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Geolocation features are enabled using the constant <code>MCS_GEOLOCATION_ENABLED<\/code>. You can set this constant in your <code>wp-config.php<\/code> file or any other standard location for configuring WordPress constant values. Do not configure it inside the <code>my-calendar-pro<\/code> directory, as it will be erased when the plugin is updated.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Geolocation shortcode and interface.<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The shortcode for Geolocation is <code>[geolocate]<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Shortcode with default values<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;geolocate latitude=\"\" longitude=\"\" radius=\"100\" limit=\"25\" unit=\"kilometers\"]<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">By default with the IP to City database, the shortcode will display a map centered on the current visitor&#8217;s location, showing the first 25 venues within a radius of 100 kilometers of that location.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The IP to City database is only used to detect the current user&#8217;s location &#8211; if you do not wish to do IP location detection, you can enter latitude and longitude coordinates to set the center of the map.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only locations that have latitude and longitude coordinates in the database will appear on the map. If you have Google Maps configured, these coordinates are added automatically if there is sufficient address information. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The unit attribute only accepts &#8220;miles&#8221; and &#8220;kilometers&#8221;. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The shortcode also generates a form to search by location. The location search uses the Google Maps geocoding API to convert address data into coordinates.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"705\" height=\"840\" src=\"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-content\/uploads\/sites\/4\/2026\/04\/image.png\" alt=\"Geolocation shortcode output, showing the search form, map, and list of locations.\" class=\"wp-image-487\" srcset=\"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-content\/uploads\/sites\/4\/2026\/04\/image.png 705w, https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-content\/uploads\/sites\/4\/2026\/04\/image-252x300.png 252w\" sizes=\"auto, (max-width: 705px) 100vw, 705px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>My Calendar Pro includes geolocation features for finding venues. Development is in progress to extend this to finding events. There are a few prerequisites to being able to use the geolocation features, due to the data and API dependencies. Services Used Geolocation features use the MaxMind GeoLite IP to City database for translating a user&#8217;s [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,13,10],"tags":[],"class_list":["post-482","post","type-post","status-publish","format-standard","hentry","category-public","category-search","category-shortcodes"],"_links":{"self":[{"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/posts\/482","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/comments?post=482"}],"version-history":[{"count":1,"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/posts\/482\/revisions"}],"predecessor-version":[{"id":489,"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/posts\/482\/revisions\/489"}],"wp:attachment":[{"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/media?parent=482"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/categories?post=482"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.joedolson.com\/my-calendar-pro\/wp-json\/wp\/v2\/tags?post=482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}