[Pro] Automatically populate map from tags or categories

You are here:

If you’re a travel blogger you’ll appreciate this feature. You can have your map be populated automatically based on the existing post categories or tags. You can automatically link them to the archive page of that category or tag, where it will list the corresponding articles.

How it works

This will work for all available maps, including the world map and country maps. The category names just need to follow the same format of the available regions for that map. In the world map, for example, the category or tags names should be the english names of the countries. For a single country map, it should be the names of the regions available for that country. For example:

[Pro] Automatically populate map from tags or categories

In the screenshot above we are displaying the map of Italy and we see the available regions for this map on the right of the screen. If you want to automatically populate this map, your categories or tags should have the same name (or IDs) used in that list.

Enable the Custom Data Source Option

If you already have some categories or tags with articles, you can proceed with the map. The first thing to do is enable the option to automatically populate the map. You can find that option in the ‘Regions’ tab, further down:

[Pro] Automatically populate map from tags or categories

You can choose categories or tags and if you want to include empty ones – that have no articles associated.

Customize the Tooltip

The next step will be to customize the tooltip. In the ‘Map Features’ tab, you can find the tooltip options and at the bottom you can customize the content template. Each region entry has some data that we can use as placeholders for the tooltip. In this case the {post_count} will be particularly useful, since it will allow us to display the number of posts for the category/tag.

[Pro] Automatically populate map from tags or categories

So in this example we use the {name} and {post_count} and include some custom text. We also enable the option to only include the tooltip for active regions. This way empty regions will not display the tooltip.

And that’s mostly it. With these steps you should be able to have a map of the world or a specific country populated automatically. Here’s an example:

Finally, if you want the map to open the category/tag archive page on click, you simply need to set the click action to ‘open url’.

[Pro] Automatically populate map from tags or categories


Posted by Carlos Moreira

Lead developer of Interactive Geo Maps plugin.