Skip Navigation

[Resolved] map not working using toolset but works with other plugin

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

Problem:
Map markers are not displaying. Other maps created without Toolset work okay.

Solution:
The wpv-map-marker shortcode was nested inside the wpv-map-render shortcode, but needs to be outside it.

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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Tagged: 

This topic contains 11 replies, has 2 voices.

Last updated by malagaS 6 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#612574

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):

{!{wpv-map-render map_id="listingmap"}!}{!{wpv-map-marker map_id="listingmap" marker_id="marker-6" marker_field="wpcf-chambermembers_mapaddress" id="$posttype"}!}{!{/wpv-map-marker}!}{!{/wpv-map-render}!}

the only place this map is taking me is crazytown. thank you 🙂

#612678

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

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.

Is that what you are trying to do?

#612695

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}!}

#612697

(seems like it wouldn't need a $posttype - it should just pick up the id of the post, right? but it doesn't work to leave $posttype out either.)

#612903

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

You are using it "in a single page template".

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.

#613056

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)

#613092

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.

#613134

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

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.

If you could try that and let me know.

#613141

made the change, purged all cloudflare cache and put in dev mode. waited 10 min. nothing.

the other app that i used to test: i removed the api on that earlier today to be sure there's no conflict. now i've removed the plugin completely.

#613142

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

OK, I think I had best get site credentials from you to check for myself how you have it set up.

This is a live site, yes?

If I don't see any obvious problem I can take a copy of the site to test locally, if that's okay.

I'll mark your next reply as private.

#613198

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

OK, the solution was actually very simple.

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.

#614147

I did try that before but there must have been something else broken at the time - it worked - thanks!

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