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.
To display posts on a map, you need to insert a Block map and then add map markers to it.
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.
After inserting a Map block, you need to add markers to it by clicking the Add marker button.
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.
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:
- Insert a Map block.
- In the Source for the marker section select Dynamic source.
- In the Post Source dropdown select a custom field that contains an address to show on the map.
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.
To add a map that uses a View as the source for the markers you have to:
- Add a View block to your page. This View must list posts that feature an Address custom field.
- Insert a Map block.
- As the source of the markers choose the View block.
- 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.
If you run into any problems or need our advice, create a new support ticket and our team will be happy to assist you.