This tutorial will guide you through dynamically setting different locations in the Elementor Google Maps widget for each page generated by LPagery. This is especially useful if you are creating location-specific pages and want the Google Maps widget to display a unique location on every page.
Step 1: Insert the Google Maps Widget with a Placeholder
Create a Template Page:
Set the Location Placeholder:
In the Google Maps widget's location input field, enter a placeholder such as
{location}
. This placeholder will be dynamically replaced with specific locations from your source file.
Note: At this stage, the map may jump to a random point — this is expected and can be ignored. The placeholder will dynamically adjust the location when the page is generated.
Save the Template Page:
Once the placeholder is added, save the template page. You are now ready to proceed with setting up the dynamic locations.
Step 2: Add Locations to Your Source File
Prepare Your Source File:
Open your source file (Google Sheet, CSV, or Excel). In this example, a Google Sheet is being used.
Add Location Data:
Create a column in your source file labeled "location".
Fill this column with the specific addresses or coordinates for each page you want to create.
Example:
location |
123 Main St, New York |
456 Elm St, Chicago |
789 Oak St, Miami |
Step 3: Generate Pages with LPagery
Go to the LPagery Dashboard:
In WordPress, go to the LPagery dashboard.
Select the Template Page:
Choose the template page that you previously created with the Google Maps widget.
Insert the Source File:
Paste the link to your Google Sheet (or upload your source file).
Create Pages:
Click on Next and proceed to create your pages. LPagery will dynamically use the location data from your source file and replace the
{location}
placeholder with the corresponding value for each page.
Step 4: Review the Generated Pages
Open the Generated Pages:
Once the pages are created, open the newly generated pages in WordPress.
Verify the Map Location:
You should now see that the Google Maps widget on each page shows the specific location pulled from your source file.
Each page will display a unique map based on the location data entered in your source file.
The Result:
Potential Problems
Sometimes the map on the created pages looks like this
This usually means, that Google did not find the location from the value from your source file.
How to fix
Check the spelling of the value from the source file that filled out the location in your Google Maps and correct it.