In the email to the visitor is a link to the Google Map, correct? Or do you have an example of a map actually embedded in the notification email?
After thinking about it, I think the best approach is to use one of the existing Google Map plugins, and get the address information out of your entry and into the function call or shortcode for the Google Map plugin. Then you can configure the defaults for the Google Map plugin, and pull the address information from the entry.
Looking more closely at it, it looks like all your real estate posts are created by a form? So, we should probably insert the address information into the content template, inside the Google Map shortcode, when the entry is accepted and before the post is created. That way, you don't need to modify your template at all, and it's all automatic.
You can pick whichever Google Map plugin you like. The process will be basically the same. I used this one: http://wordpress.org/extend/plugins/google-map-shortcode/
With that plugin active, you can use this shortcode in your post: [google-map-sc]
We need to add some details to that shortcode. I did this in the content template for my post body.
This map was submitted by {Name (First):3.3} {Name (Last):3.6} on {date_mdy}.
[google-map-sc type="HYBRID" width="584" zoom="18" address="{Address (Street Address):2.1} {Address (Address Line 2):2.2} {Address (City):2.3} {Address (State / Province):2.4} {Address (Zip / Postal Code):2.5} {Address (Country):2.6}"]
That content template ended up creating a post with this content for a form submission I just made:
This map was submitted by Hajii Gomeshi on 08/19/2012.
[google-map-sc type="HYBRID" width="584" zoom="18" address="1301 S. Harlem Ave Berwyn Illinois 60402 United States"]
View the post: http://gravity.chrishajer.com/?p=844
There are a lot more parameters you can use for that shortcode. Documentation is here: http://web-argument.com/2011/08/11/google-map-shortcode-reference/
The merge tags are dependent on your form. Those were the merge tags from my form. You can see my form online here: http://gravity.chrishajer.com/embed-a-google-map/
If you submit that form, you will have a link to the post it creates in your on-screen confirmation. Click that and you will see the map embedded based on the address you entered.
Let me know if you have any questions.
Posted 12 years ago on Monday August 20, 2012 |
Permalink