MapPress FAQ

Google Maps API keys

Google requires an API key to use the Google Maps API.  You’ll need one to use Google as the MapPress mapping engine. If Leaflet is the mapping engine, a Google API key is only needed if you’re using the Google geocoder.

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.

The 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, for the ‘geocoding’ function to generate maps from custom fields.  If you have left your browser key unrestricted, you can use the same key.

If you restricted the browser 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 API key issues

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. See the Troubleshooting section if there are console errors indicating the API has been loaded more than once.

Troubleshooting

Maps don’t display or can’t be edited

These problems are almost always due to a theme or plugin conflict.  It only takes a minute to find out:

  1. Disable all plugins except MapPress.  On the WordPress plugins screen select all plugins except MapPress and choose ‘deactivate’ in the bulk actions dropdown. Check your maps again.  If they’re working, re-activate one by one until you find the error.
  2. Try a standard theme.  Install and activate one of the WordPress themes, like “twenty twenty”.  Check your maps again.  If they’re working, there’s a theme problem.

Resolving conflicts

  • Theme or plugin loads obsolete version of jQuery
    Unfortunately this is very common.  Try to update the theme or plugin to the latest version.  If that doesn’t help, you’ll need to contact the author to resolve it, or deactivate it.
  • “Minifier” or “Optimizer” plugins
    These plugins often mangle or break included JavaScript and CSS.  Try Excluding the MapPress files (mappress_index.js and mappress_admin_index.js), MapPress CSS (mappress.css), and Google API (maps.googleapis.com) from your minifier plugin.  Please also contact me and let me know – I can try to add MapPress to the plugin’s exclusion list.
  • Underscore not loaded
    Some themes and plugins block the ‘underscore’ library from loading properly. Try to update the theme or plugin to the latest version.  If that doesn’t help, you’ll need to contact the author to resolve it, or deactivate it.
  • Google Maps API loaded multiple times
    If there are errors in the browser JavaScript console (F12 in most browsers) indicating the maps API has been loaded more than once, it’s because a theme or plugin is loading the API in addition to MapPress. Try checking the ‘compatibility’ checkbox in the MapPress settings. If that doesn’t work, you’ll need to contact the author to resolve this. Please also contact me so I can add the plugin/theme to the compatibility list.
  • Theme is missing a wp_footer() call
    This is rare in modern themes but it does sometimes happen with custom themes.  All that’s needed is to add the wp_footer() call to the theme footer file:
    http://codex.wordpress.org/Function_Reference/wp_footer

Other issues

Here are some other common issues and their resolutions:

  • Mashups don’t display, or [mashup] shortcode shown instead
  • This indicates the free version of MapPress has been installed over the Pro version.  Just go to your account and reinstall the Pro version (instructions are on the download page).
  • 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.
Will I lose my maps when I upgrade to MapPress 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.

Maps not showing in tabs or hidden elements

Maps may not display properly when they are inside an element that is initially hidden, such as a tab, slider, or accordion.  Hidden elements report their size as zero, so the map will be drawn with no size.

MapPress includes a built-in workaround for jQuery UI Tabs.  For other elements you’ll need to implement your own solution using JavaScript.

When the hidden element is displayed, redraw the map by calling its resize() method.  You may also need to re-center the map. For example to redraw and re-center the first map on the screen use:
mapp0.resize();
mapp0.recenter();

Here’s an example that redraws all the 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 can be resized:

jQuery(document).ready(function() {
  // Resize all maps on the screen
  jQuery('.mycontrol').on('click', function() {
    jQuery(document).find('.mapp-layout').each(function() {
      var id = jQuery(this).attr('id'); // e.g. mapp0-layout
      var mapid = id.replace('-layout', '');
      var map = window[mapid];
      setTimeout(function() {
        map.resize();
        map.recenter();
      }, 350);
    });
  });
});

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.