Skip Navigation

[Resolved] Unable to Display Marker with Google Maps Shortcode

This thread is resolved. Here is a description of the problem and solution.

Problem: I am trying to display a map on my child post, and insert a marker using the address field of a parent post. The marker is not appearing and the map is showing the ocean.

Solution: Ensure the address field is set correctly, and use the id operator and specify the parent post type slug in the marker shortcode:

[wpv-map-marker map_id="unit-map" marker_id="unit-marker" marker_field="wpcf-property-address" id="$property"][/wpv-map-marker]

Relevant Documentation:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
https://toolset.com/documentation/user-guides/display-on-google-maps/

This support ticket is created 6 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by zacharyL 6 years, 2 months ago.

Assisted by: Christian Cox.

Author
Posts
#615431

I am trying to: Get a map to display with a marker within a single post layout, utilizing address information provided from a parent post's Google Maps address field.

Link to a page where the issue can be seen: hidden link

I expected to see: A marker on the map.

Instead, I got: A map, but it doesn't display the marker, and puts the view somewhere in the middle of the Pacific Ocean.

Here's my markup:

[wpv-map-render map_id="unit-map" map_height="600px" marker_icon="/wp-content/uploads/2018/02/location.png"][/wpv-map-render]
[wpv-map-marker map_id="unit-map" marker_id="unit-marker" marker_field="wpcf-property-address" id="$parent"][/wpv-map-marker]

This markup is contained within a single post layout for my "Unit Type" custom post type. This post type is parented by the custom post type "Property" which governs global information, such as a property description, image gallery, and a map to the location.

I followed the instructions in the documentation verbatim. I even tried putting the field directly into the "Unit Type" post type, and still received the same results (or lack thereof). My example above has a customized map ID, because I tried the default settings before configuring my own. I also attempted to use $posttype and $property as values for the ID parameter for the marker, and even initially left it to the default value, to no avail.

Currently the Google Maps API key has no restrictions enabled until I can get the map working correctly.

I don't know what I'm doing wrong here. I can accept that the map won't work off of parent post relationships, though the documentation implies otherwise, however I can't even get it to work directly from the "current post". Please help.

#615434

Hi, I don't see anything in the address field of the Copperleaf property post here:
hidden link

What happens if you fill in an address for the property?

#615439
screenshot.jpg
screenshot.jpg

The field was populated, though when I went in after you were looking around (not implying you changed anything), it wasn't. I have refilled the location field. Still the same results.

#615443

I made a minor adjustment to the Layout's Visual Editor cell code. Your previous marker shortcode used id="$parent", and I have replaced that with the more specific identifier id="$property":

[wpv-map-marker map_id="unit-map" marker_id="unit-marker" marker_field="wpcf-property-address" id="$property"][/wpv-map-marker]

Please let me know if the results are still not showing as expected, and I can take a closer look.

#615447

I had tried that, and it didn't work when I did. Well, hey it's working now -- I'm not complaining. Thank you very much for your assistance.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.