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?
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
Thanks for the details, I am checking it in your website, will update here if find anything
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.
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.
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"?
1) Campings
2) Adres van het vakantiepark
3) These are all the pages under custom post type 'Campings'. For example /camping/landal-rabbit-hill/
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
Hi Luo,
Thanks for your assistance! I can confirm that your modifications solved the problem. We have got it working now.
Cheers
Please close this thread, you can create new ticket if there is other new issues.
My issue is resolved now. Thank you!