Toolset allows you to display WordPress posts on Google or Azure maps. Use the Toolset Map block to display a map and add map markers coming from custom fields.

How-to steps

To display posts on a map, you need to insert a Block map and then add map markers to it.

Inserting a Map block

You can insert the Map block into your templates, Views, archive pages, or regular WordPress pages.

You need to be familiar with the WordPress Block Editor. If you’re not, take a few minutes to learn how to use the Block Editor.

The Map block provides you with many options and ways to customize your maps. Use the options in the right sidebar to adjust all of the settings when you insert or edit a Map block.

Setting up map options
Setting up map options

Adding map markers

After inserting a Map block, you need to add markers to it by clicking the Add marker button.

Adding the marker to the map
Adding the marker to the map

You can set different options for each marker. This includes changing the marker icon, adding content displayed when hovering or clicking a marker, and more.

Marker settings
Marker settings

Using custom fields for map markers

The Map block also allows you to use a Dynamic source for map markers. This means that the marker’s location comes from a custom field, for example. This is especially useful when creating Content Templates for your custom post types.

Use the following steps to insert map markers whose location comes from custom fields:

  1. Insert a Map block.
  2. In the Source for the marker section select Dynamic source.
  3. In the Post Source dropdown select a custom field that contains an address to show on the map.

Use a Dynamic source for map markers
Use a Dynamic source for map markers

Using Views as the source of the markers

You can use Views as the source for the location of your markers. This allows you to generate a map based on a View. It is important to place both View and Map blocks on the same page. You can use an existing View, or you can create a new one. It is only important that the View has access to the address custom field.

You can use a View as a source for the map markers even if that View has no visual output. However, if you do display the results, you will see some additional features. For example, if your View uses pagination, as you go through pages, the markers on your map will update.

Map with pagination controls
Map with pagination controls

To add a map that uses a View as the source for the markers you have to:

  1. Add a View block to your page. This View must list posts that feature an Address custom field.
  2. Insert a Map block.
  3. As the source of the markers choose the View block.
  4. In the View block dropdown choose the name of the block you have inserted and in the Field dropdown select the custom field that contains the address.

Settings for the map that uses a View as the source for the markers
Settings for the map that uses a View as the source for the markers

Need help?

If you run into any problems or need our advice, create a new support ticket and our team will be happy to assist you.