Home › Forums › MapPress Support › Automatic Map Creation by Address (Post Title)
Tagged: address, post_title
- This topic has 3 replies, 2 voices, and was last updated 9 years ago by
Chris.
-
AuthorPosts
-
January 27, 2014 at 8:06 am #14140
Is there a way to have a map automatically generated/displayed, based on the post_title, which is actually the full address? It’s for a home builder’s website. I’ve searched, but can’t find a definitive answer. I’m almost positive that maps were being generated, in this fashion, before this site went “live” (it was already “live”, but on a subdomain). Now, the maps aren’t being generated.
January 27, 2014 at 9:10 am #14141Hi,
The maps are only generated from custom fields. The plugin doesn’t read the post title.
If you can copy the post title to a custom field when the post is saved, that might work. Then the map could be generated from that field. For example, copy the post title to a field called ‘address’.
That would require a little PHP. I think you could use this event:
http://codex.wordpress.org/Plugin_API/Action_Reference/save_post
January 27, 2014 at 10:10 am #14142Hey, Chris. Thanks for responding.
I added a custom field called “actual-address”. I set MapPress to use that field for “Address Line 1”. I’m using a content template to display a custom post type of “Home” (for a home builder). The posts (Homes) are created on the front-end of the website. I’m trying to keep the client out of the back-end, just for convenience and user-friendliness. Unless “[mappress]” is added to the body of the post, using the WP editor (back-end), the maps are not generated and, therefore, not displayed.
Any ideas on how I might overcome this issue? If I were just able to throw “address=…” into the [mappress] shortcode (in the content template), I think I’d be golden.
January 27, 2014 at 10:36 am #14143Hi,
The [mappress] shortcode doesn’t have anything to do with auto-generation of the maps. But they don’t get generated until a post is saved or published, so maybe it’s a timing issue?
Try this: go to a post where you have an ‘address’ custom field and publish it – you should see the map generated, without needing to put the shortcode in the post.
The shortcode doesn’t take an ‘address’ attribute because you would then need to geocode that address every time a page is displayed. It would slow down your site and you could hit the Google usage limits (see the docs for details).
-
AuthorPosts
- You must be logged in to reply to this topic.