Skip Navigation

[Resolved] Google maps in iframe embed not working correctly

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

Problem:

Display maps + markers from different related posts.

Solution:

You can follow our document to get related posts, and display those markers in the same map.

Relevant Documentation:

https://toolset.com/course-lesson/displaying-related-posts/

This support ticket is created 3 years, 5 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 10 replies, has 2 voices.

Last updated by mennoP 3 years, 5 months ago.

Assisted by: Luo Yang.

Author
Posts
#2246969

Tell us what you are trying to do?
On our Holiday Parc pages we are currently showing a Google Map with the location of the Holiday Parc (based on an address field) and with interesting Sights within a 25km radius of the location of the Holiday Parc.
This works perfectly.

We want to replace this with a map on a separate page by iframe embed, to load later on demand. The map in the iframe however only shows the location of the Holiday Parc and not the location of the sights within a 25km radius.
We use URL parameters to set the Query Filter in the map view:
- When we use the view with query filter 'Post ID’s' set to include only ’Posts with ID’s set by a URL parameter “post_ids”’ (post_ids=[wpv-post-id]) it only shows the location of the Holiday Parc.
- When we use the view with query filter ‘Distance’ set to field ‘Distance center is set by URL parameter “mapcenter”’ (mapcenter=[types field='adres-van-het-vakantiepark' format='FIELD_LATITUDE,FIELD_LONGITUDE'][/types]) it doesn't filter or center, so there should be something wrong.

How can we show the map, with – and centered on – the Holiday Parc marker and additional showing all Sights in a radius of 25km, correctly in the iframe?

Is there any documentation that you are following?
https://toolset.com/forums/topic/view-larger-map/
https://toolset.com/documentation/legacy-features/views-plugin/passing-arguments-to-views/

Is there a similar example that we can see?
Not that i'm aware of.

What is the link to your site?
We are developing this on our staging environment. Can i share the link privately?

#2248473

Hello,

Are you using Toolset Maps shortcode [wpv-map-render] to display the Google maps? or just a HTML iframe tag?
I have enabled the private message box, please provide your website credentials in it, also point out the problem page URL and view URL, thanks

#2249421

Thanks for the details, I am checking it in your website, will update here if find anything

#2249457

I have done below modifications in your website:
1) Edit the post view "Vakantiepark (maps) - iframe test"
hidden link
in section "Loop Editor", change the map shortcode attribute: fitbounds="on", like this:
[wpv-map-render map_id="map-17" map_height="600px" fitbounds="on" general_zoom="10" general_center_lat="[wpv-search-term param='wpv-lat']" general_center_lon="[wpv-search-term param='wpv-lon']"][/wpv-map-render]

2) Test it in frontend by passing URL parameter "mapcenter"
hidden link

It works fine, can you confirm it?

More help:
https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-render
fitbounds. Optional, defaults to on. Can be on or off. When on, the map zoom and center will be calculated to show all the markers at once in the closest possible view.

#2249517

Hi Luo,

Thanks for your assistance. There is however 1 item which isn't working as we want it. The map also shows markers for the other holiday parcs within a 25km radius. We want to show only a marker for the 1 concerning holiday parc and the markers for the sights (uitstapjes) within 25km radius of the park. The map should be centered on the marker of the holiday parc.

On our holiday park pages you can see 2 maps. The original one and below that the iframed map. The iframed map should be exactly the same as the original one.

#2250489

Your website isn't in English, to avoid more misunderstandings, please provide more detail for these:
1) Which custom post type is the "holiday parcs"?
2) Which custom address field is for "holiday parcs"?
3) Where and how can I see the "our holiday park page"?

#2250623

1) Campings
2) Adres van het vakantiepark
3) These are all the pages under custom post type 'Campings'. For example /camping/landal-rabbit-hill/

#2251355

Thanks for the details, I have done below modifications in your website:
1) Create a content template "iframe content template by post ID of Campings"(slug : test-ct-2):
hidden link
With below codes:

[wpv-map-render map_id="map-17" map_height="600px" fitbounds="on" general_zoom="10"][/wpv-map-render]
[wpv-map-marker map_id='map-17' marker_id='marker-[wpv-post-id]' marker_field='wpcf-adres-van-het-vakantiepark']
Here add more information about Campings post
[/wpv-map-marker]
[wpv-view name="vakantiepark-maps-iframe-test" mapcenter="[types field='adres-van-het-vakantiepark'][/types]"]

It will display the google map + marker of Campings post + post view "vakantiepark-maps-iframe-test".
As you can see, you can pass the address value as shortcode attribute "mapcenter" of [wpv-view]

2) Edit the post view "vakantiepark-maps-iframe-test"
a) In section "Query Filter", change the filter to:
Show posts within 25km radius of address/coordinates provided using mapcenter shortcode attribute.
b) In section "Loop Editor", remove the map shortcode and Campings post marker

3) Edit the page "View: Vakantiepark (maps) - iframe test":
Add a shortcode block, and display above content template like this:
[wpv-post-body view_template="test-ct-2" item='[wpv-search-term param="wpv-id"]']

It will use URL parameter "wpv-id" to render the content template of step 1

Test it in frontend by pass URL parameter "wpv-id"(value is the Campings ID), like this:
hidden link

It works fine, can you confirm it? thanks

#2252099

Hi Luo,

Thanks for your assistance! I can confirm that your modifications solved the problem. We have got it working now.

Cheers

#2253237

Please close this thread, you can create new ticket if there is other new issues.

#2255383

My issue is resolved now. Thank you!