Display pins of posts on Google Map

Display pins of posts on Google Map

To display pins linking to posts on the map, you need to add locations to your posts first. Please read the following section.

In Classic Editor

When you write a post, scroll down the edit page and then you will find the Eaven Single Post Options panel > Location field. If you are writing a post about a destination (country/states/city/etc.), you can add the name of this destination to the Location field, such as “Sydney, NSW, Australia“.

Please note: Do not add same location to different posts, otherwise, the post information cannot be displayed on the map when clicking on the pin.

Latitude & Longitude

After adding a location to a post, when saving the changes to this post, the Latitude & Longitude values will be generated automatically from the location added. The Latitude & Longitude values are required to display a pin on the map. You can add custom Latitude & Longitude values if the map pin location in incorrect.

Please note: The Google Map API key is required to auto generate Latitude & Longitude values.

If you added some locations before adding your Google Map API key, please:

  • Method 1 – Re-save the posts to auto generate the Latitude & Longitude values.
  • Method 2 – Or, on the post list page (dashboard > Posts > All Posts), find the “Map Location” column, then click on the “Generate Latitude & Longitude” button for each post.

In Gutenberg Block Editor

If you use Gutenberg Block Editor, you can find the field for adding location in Theme Settings > Map Settings > Location field.

Add post location in Gutenberg editor.

Then, when you add a Google Map to your homepage (using the home widgets “Google Map”), or add a Google Map to your post/page content (using Google Map shortcode or Gutenberg block), you will see a pin shown on the map. Click on this pin to display the thumbnail (featured image) and title of this post. Click it to go to this post.

Pin of a post on the map.