MapPress FAQ

Google Maps API Keys

Google requires an API key to use the Google Maps API.

Get a Browser API key

  1. Use this link to go to the Google Developer Console
  2. From the projects list, select a project or create a new one
  3. Click Continue to enable the API and any related services.
  4. On the Credentials page, get an API key
  5. It is usually easiest to start with an unrestricted key, but if you want you can secure the key so it can only be used specific web sites::
    a) Select Restrict key to set a browser restriction on the API key.
    b) In the Key restriction section, select HTTP referrers (web sites), then follow the on-screen instructions to set referrers.
  6. Copy the API key and click ‘OK’.  Paste the key into the MapPress settings screen.

Note: this Google Developer Console link should automatically enable the correct APIs.  If you need to enable them manually, go to the Library menu and enable: Google Maps Javascript API, Google Places API Web Service, Google Maps Geocoding API, Google Maps Directions API, Google Maps Geolocation API

Get a Server Key

A server key is only required for MapPress Pro, and only if you wish to use the geocoding function to generate maps from custom fields.  If you have left your browser key unrestricted, you can use the same key.

However, if you restricted the key by HTTP referrers, it won’t work because the geocoding API calls come from your server, not from a specific web site.  You will need to generate a new key and restrict it by your server’s IP address:

  1. Follow the steps above to create a new key
  2. This time, choose Restrict key and select IP addresses in the Key restriction section.
  3. Enter your server’s IP address

Google Maps API Problems

Check your browser’s JavaScript console for any errors.  If your API key is invalid, get a new one using the steps in Get a Browser API key

A common error is having the maps API loaded multiple times. Google only allows the API to be loaded once per page, so if another plugin or theme loads the API this can cause various errors:

To check for conflicts:

  1. Deactivate ALL other plugins and switch to the standard Twenty-Seventeen theme (for a moment).
  2. If the maps work, reactivate the original theme and plugins one by one to find the problem.

To resolve a conflict:

  1. Set the ‘compatibility’ checkbox in the MapPress settings
  2. Most themes (and some plugins) provide a checkbox to disable loading the maps API.
  3. Contact the theme or plugin author for a fix
  4. Use at most one plugin per page.

Troubleshooting

These are the most common issues:

  1. Maps API problems
    See the Google Maps API Problems section.
  2. Error in another plugin or theme
    Disable all of your plugins and switch to a standard theme (for a moment).  If you now see your map, re-activate until you find the error.
  3. Theme is missing the wp_footer() call
    See here for details: http://codex.wordpress.org/Function_Reference/wp_footer
  4. Theme or plugin loads obsolete version of jQuery
    If the jQuery version is too old, you’ll see an error in your browser’s javacript console.  The minimum version is 1.7 (released 4 years ago).  You’ll need to update the theme or plugin or deactivate it.
  5. “Minifier” plugins
    Exclude the MapPress files (mappress.min.js) or Google URL (maps.googleapis.com) from your minifier plugin.

Map Won’t Save

This is caused by  errors in another plugin or the theme.  Disable all plugins and switch to a standard theme (for a moment).  If you now see your map, re-activate until you find the problem.

Will I Lose my Maps when I Upgrade to Pro?

Don’t worry – your maps will continue to work.  You’ll gain all the new Pro features but your existing maps are fully compatible.

Map is grey or only a corner of the map displays

Google maps do not display properly when they are inside an element that is initially hidden, such as a hidden tab, slider, accordion, etc.  MapPress includes a workaround for jQuery UI TabsFor other libraries or controls, you’ll need to implement your own solution using Javascript.

When a hidden element is displayed, you can redraw the map by calling its resize() method.  For example to redraw the first map on the screen use:
mapp0.resize();

This example redraws maps inside elements with class ‘mycontrol’ when the element is clicked.  Note that setTimeout is only needed if there is an animation (such as sliding into place) that must complete before the map is resized:

jQuery(document).ready(function() {
jQuery('.mycontrol').on('click', function() {
jQuery(this).find('.mapp-canvas').each(function() {
var id = jQuery(this).attr('id');
var map = window[id];
setTimeout(function() {
map.resize();
}, 350);
});
});
});

POIs are in the Ocean near Africa

This happens when a POI can’t be geocoded.  Either the POI location is invalid or you are over your Google query limit.  See the documentation for information about query limits.

Can’t change marker icons

MapPress Pro is required to change the map icons.

Map exists but doesn’t appear in the post

Check that a [mappress] shortcode is present in the post.  The documentation shows you how to do it step by step.

Post displays [[mappress]] shortcode instead of the map

This indicates MapPress has been deactivated or it can occur because of a very old WordPress bug: each shortcode must be on a separate line.  Edit the post and check that there is a carriage return between shortcodes and any surrounding text.

Translating MapPress

WordPress plugin translations are created using the POEdit utility. MapPress translation files are stored in the languages directory of the plugin.

Creating a New Translation

  1. Download the latest POEdit
  2. Run POEdit and open the master file mappress.pot or mappress.po from the languages directory of the MapPress plugin
  3. Use the menu File->Save as to save it as a .po file (a translation).  The file name must include an extension for your language.  For example, ‘mappress-es_ES.po’  is for Spanish.  A list of valid language extensions is here.
  4. Translate the strings.
  5. When you’re done use menu ‘file->save’ to save the file again.  POEdit should create a .MO file (a compiled translation) with the same base name as your .PO file.
  6. Send me both the .PO and .MO files, and I’ll include them with all future versions of MapPress!

Updating an Existing Translation

MapPress texts change frequently so you may find there is an existing .PO file for your language but the translation isn’t up to date.  If that happens:

  1. Run POEdit and open the .po file.  For example, for Spanish open mappress-es_ES.po
  2. Use the menu Catalog->Update from POT file. Select the file mappress.pot or mappress.po
  3. Update any missing strings.
  4. Correct any fuzzy strings (they appear in a different color at the top of the file).  For each one, click on menu Edit->Translation is Fuzzy to remove the fuzzy indicator.  You can also hit ALT-U.
  5. Save your .PO file.  POEdit should re-generate the corresponding .MO file.
  6. Send me both the .PO and .MO files, and I’ll include them with all future versions of MapPress!

Still Stuck?

I’ll be happy to help.  Please contact me and let me know you’ve already taken the steps listed above.  Please send everything I might need to reproduce the problem, including any error messages and a URL or screenshots illustrating the problem.