Create a Map and Marker Using Custom Fields

November 27, 2014 9:14 am Published by 26 Comments

 

This article covers Create a Map and Marker Using Custom Fields with the WP Google Maps Pro Add-on. This feature requires WP Google Maps Pro. This documentation is current for WP Google Maps version 6.

 

Note: You’ll need to edit a page/post, enable custom fields at the top of the page and then enter in a map_id, lat, and lng, it will then render a map at the bottom of the page.

 

With the latest versions of WP Google Maps Pro you can call a Map and Marker on a Post or Page using WordPress Custom Fields.

 

Open the Post or Page where you want to display the Map and Marker. At the top of the Edit Page (or Edit Post) panel, click Screen Options. Then click the checkbox for Custom Fields to enable Custom Fields for this Page.

 

Scroll down to the Custom Fields section and click the Enter new link.

 

Add new Custom Fields for each of the following (assuming this is the first time you’ve used this functionality):

 

  • Latitude
    • Name: lat
    • Value: Latitude of Marker to center on Map
  • Longitude
    • Name: lng
    • Value: Longitude of Marker to center on Map
  • Map ID
    • Name: map_parent_id
    • Value: Map ID of Map you wish to use. This will allow you Map to take on all the Map Settings from that Map (width, height, Map Type, Zoom Level, etc…) If no ID is specified, the default is the first Map in the database.

 

 

Publish your Post or Page and then click View. Your Marker will be centered on the displayed Map.

 

 


 

This article covers Create a Map and Marker Using Custom Fields with the WP Google Maps Pro Addon. If you need further assistance, feel free to post on our Support Forums or visit our Support Desk.

 

Tags: , , , ,

Categorised in:

This post was written by Nick Duncan

26 Comments

  • Hi,

    Is it possible to extract the “lat” and “lng” fields from ACF Google Map custom field (https://www.advancedcustomfields.com/resources/google-map/)? It would make the user interface and experience much better than just using “lat” and “lng” number fields.

    Best Regards,
    Henri

  • Pascal Basel says:

    Is it possible to categorize the marker directly, so that it is shown in a big map with lots of other markers, that can be displayed by category?

  • Natia says:

    Hello,

    We recently purchased the PRO version of WP Maps. We would like to have pins on multiple locations for every product we have sold (so it is easy for customers to see what has been sold in different locations). We do not have information on LAT and LNG for each location, all we have is a box number or postal code.

    Are we able to add pins to map with out using LAT and LNG? And if so, how do we do it?

    Please advise

    Thank you,

    Natia Devloo

    • Veronique says:

      Hi there. You may enter postal codes into the address field; the API will then attempt to locate a close central point. However, if this fails, you may need to provide area/town etc. 🙂

  • Lee Fuller says:

    How can we use information in the WordPress database to populate markers on a map?

    • Veronique says:

      Hi there. Unfortunately this is not supported at the moment, however we will be adding additional data source options in future.

  • Mario Orozco says:

    Hi!

    Is it possible to do this from WooCommerce products too?

    Regards,

  • Igor says:

    Hi there,

    I’m considering to buy this plugin for my website. I have 2 questions

    1. Is there a contact form within the markers or listings? And can is specify to sent this email to my own emails adress or the address of the store.
    2. Is it possible to make the urls in the listings and markers rel=nofollow?

    • Veronique says:

      Hi there Igor,

      Nice to hear from you. 🙂

      1. This requires shortcode support, which will be available in Version 7 of WP Google Maps.
      2. We can add this for you. 🙂

      I hope that helps?

  • Xavier says:

    Hi there,

    If I understand well, this wouldn’t work with any other custom fields? We’re using a template that uses other names for lat and long. What we were hoping to achieve was to have a default Google Map Street View image for each listing. Do you think your plugin would work?

    Thanks,

    • Veronique says:

      Hi there Xavier,

      Unfortunately, this is not do-able with Version 6 at this stage in time. However, we are looking at this for Version 7, which should be released later next year. I hope that helps? 🙂

  • Zavrazhnov Kirill says:

    Hi! I have purchased the plugin and it’s great. However, I have something which doesn’t properly. I have custom post type which has lan lng and map_parent_id in meta data. I have a map winch id is 1 and an archive page with this map. I’d like to have these posts markers on the map. Please, help me figure it out.

    • Veronique says:

      Hi there,

      Unfortunately, our plugin stores marker data in it’s own table, not in the posts table. There is no way to have a relationship between a post and a marker. We can provide you with an SQL query to convert from one to the other, but if you need them to be dynamically linked I’m afraid that isn’t possible at the moment. We will be integrating this into a future release by popular demand, however at the moment I’m afraid what you are describing is not possible.

      So sorry for the inconvenience caused!

  • Jon says:

    Hey im looking at getting this plugin again for one of my upcoming projects.

    So if i add the long and lat as detailed above to all my posts, is there then a way to plot all of the posts with locations on a map?

    If so how?

    Thanks

    • Veronique says:

      Hi there Jon.

      Unfortunately, is no correlation between posts and markers at the moment, so this is not possible. This is a feature we are very keen to implement, but for the time being there is no relationship.

      If it helps, one of the developers can give a database query to read the posts and insert markers at the post meta lat/lng, including a link back to the post in the markers infowindow (assuming you have pro).

      If you would be interested in this, kindly get in touch on our Contact Us page. 🙂

  • waleed says:

    I need to extract from the lat log from url to live time to track it. can that be possible in you plugin.
    thank you very much

  • Jen says:

    Would users have to use latitude/longitude for this? Is there a way to create a custom field for an address instead? What about for multiple markers?

    Thanks!

    • Veronique says:

      Hi there Jen,

      In Version 7, you could use GPS coordinates in the built in “address” field, then create a custom field to display an alternative address
      You can do that with as many markers as you like.

      I hope this helps?

  • Sebastian says:

    Hi. it is possible to have a page for logged in users, where they can be able to select their location in a map, this info get stored (lat, long), and later in my home page map this info is showed.

    PD: With a few info like title, etc.

    Thanks.

    • Veronique says:

      Hi there, ‘

      Thank you so much for getting in touch.

      May I ask you to please send us a ticket and elaborate on this here: https://www.wpgmaps.com/contact-us/

      Assuming you want to display the closest marker, this is possible, but I would be happy to put you in touch with one of our lead developers to assist and advise on this. 🙂

  • natchanon9 says:

    Hi,

    I just purchased Pro version. I can’t find where I can paste a geojson file. Could you please help?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.