Dynamically Creating Google Maps Via the Directory and Google Maps Plugins

In this forum post (https://premium.wpmudev.org/forums/topic/add-a-google-map-to-directory-listing) there was a discussion on how to add a Google Map to a Listing.

What I'd like to know, is how can I add a Google Map to a listing based on a custom fields?

Example: User, Bob, signs up to add his store to a directory. He inputs his address into multiple CustomPress address fields (Street, City, State, Zip). When he views his listing, it's created a dynamic Google Map for him.

  • Troy
    • Site Builder, Child of Zeus

    Sorry I'm dense. I see the settings now in my Google Maps plugin, but it's not apparent how to tie that into my listings.

    The Google Maps Plugin Usage page also doesn't indicated how this is configured:
    https://premium.wpmudev.org/project/wordpress-google-maps-plugin/

    I tried checking "Yes" to the "Use custom Post Meta fields support". I then added "Google Map Address" to the Address field name. I also checked "Yes", to show the map automatically.

    No field for a Google Map shows up on the listings. Neither does it show up on the Posts. I double checked the Display options, thinking it might have been hidden, but the option wasn't in there either.

    How should I configure this so that Google Map shows up on listing pages?

  • Kimberly
    • Champion of Loops

    Hi there!

    I'm trying to track down some updates and info to see if we can make this work, as I know before the Directory re-code we were not able to use google maps in the post type.

    In the meantime, could you tell me if you can get a map to show by using the icon on the backend in the editor and putting the address there? I'll see if I can do some tests myself as well.

    Best,

    Kimberly

  • Kimberly
    • Champion of Loops

    I can get a map to post from the backend, using the add map icon on the editor.

    I did some checking and noticed that Directory had an update on 6/4 that allowed for use of shortcodes, meaning that it should work that way for sure if you are using the latest version.

  • Troy
    • Site Builder, Child of Zeus

    I am able to add a map to a post, using the Map Icon, just above the WYSIWYG area.

    However, this won't work for my needs. I don't believe that someone new to Wordpress, who is in the process of creating their own directory profile listing, would ever thing to click on the map icon.

    This could also pose problems for anyone trying to get a consistent look and feel to their directory listings because each user would have the ability to modify the look of their map.

    What I need is to have the user simply add their address to their listing profile by typing into a CustomPress field. Then I'll have my PHP template render a Google Map, the right size and in the right place, with the correct location.

    Here is what my CustomPress fields look like in Wordpress and what I need the page to look like when I'm done.

    I have everything working except for the Google Map right now. Thanks to Arnold, I was able to get the YouTube Video working and everything else was just a matter of styling.

    (For the logo I'm using the Featured Image, which isn't ideal but it's working for now.)

    I hope this makes sense what I'm asking for and thank you for all of your help with this!

  • Patricia BT
    • Connector

    Hi troycdunn

    I'm unfortunately not able to help you, but I write here as I would like the same behaviour as you are asking about Google Maps, so then I can follow this topic

    also, you managed to have the Directory to output very beautifully, (your last image above) and if you can give me some directions on how to use the directory theme or where to customize... me I only get a white screen and not even able to use the theme.

    I tried to use the directory either in my theme, or in a subsite with theme provided with the directory (as main site is buddypress, maybe it's a problem)

    I'm really sorry to interfer in your topic, but I really love what I see on you image.
    thank you in advance

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.