I am trying to: insert a map and marker on a page using an address from types post field (address field)
Link to a page where the issue can be seen: hidden link displays map but no marker. no error in console.
I expected to see: map marker which works with a different plugin (static address): hidden link (so the api is working)
Instead, I got: no marker
-api is working with another plugin so i don't think it's an api issue
-I'm using address field from types - the address seems legit because the map is generated in the -backend cred form
-i've tried using $posttype and $parent and every code example i could find in support docs
-my current code on a single page template (map from other plugin works on this very same page (with static address for marker):
It looks like you are trying to display a marker for an address that comes from a parent post type, is that right?
You have used id="$posttype" above. This is an example text only. You need to use the actual slug of the parent post type. So if I am trying to retrieve the address from a parent post of the type "location", I would use id="$location", for example.
yes, tried that too. my code is in a single page template. i'm using fusion builder but have also tried it - in a blank test template with classic editor and nothing else but this code - doesn't work:
{!{wpv-map-render map_id="listingmap"}!}{!{wpv-map-marker map_id="listingmap" marker_id="marker-6" marker_field="wpcf-chambermembers_mapaddress" id="$chambermember"}!}{!{/wpv-map-marker}!}{!{/wpv-map-render}!}
You mean you are using it in the template for a child post type? Because when you are using the id="$chambermember" attribute you are indicating the marker should come from the parent post (of type chambermember) of the currently displayed child post.
That works when I test it, so I'm just trying to clarify that you are using it as intended before considering that there may be a bug or conflict involved.
i don't think it's a child post type? it's just a post type. the single page template displays the address with no problem - if i output as text - but that same field doesn't seem to work with the map marker. i've added the field as text just under the map: hidden link
here's my code - without the id at the moment:
{!{wpv-map-render map_id="listingmap"}!}{!{wpv-map-marker map_id="listingmap" marker_id="marker-6" marker_field="wpcf-chambermembers_mapaddress" }!}{!{/wpv-map-marker}!}{!{/wpv-map-render}!}
{!{types field='chambermembers_mapaddress'}!}{!{/types}!} (this is displaying the address as text with no problem)
this is what i'm staring at. have tried without fusion builder too - as i said in the beginning - also tried a new template with nothing else but the map. this site is live so I can't do that again right now.
OK, the use of the id attribute was confusing me, if you want to display a marker for the currently displayed post then you should not be using the id attribute.
Having visited your link I suspect it may be an API issue after all.
We have a current internal ticket where this is still being confirmed, but it seems to be the case that we need to update our advice about the Google API key. The Toolset requests to the Google API are server-to-server requests, and in such a scenario Google indicates that the API key should have no URL referrer restrictions. There are no security or quota implications because the requests are not made by the client.
I'm still waiting for confirmation of that, but if that's the case we will be updating our documentation accordingly.
I suggest you try and remove the URL referrer restrictions on your API key and test again, when I suspect the marker will display correctly.
If you are using another Google map provider on your site which makes client-based requests, then you would need two API keys, one with and one without URL referrer restrictions.
The custom format used to denote shortcodes when used with page builders (the curly braces instead of square brackets) makes them a little harder to visually parse, but looking at the template on your site I could see more easily that you had the marker shortcode nested inside the map shortcode.
I simply moved it outside of the map shortcode and it now works as expected.