Skip Navigation

[Resolved] Show places in a certain radius

This support ticket is created 2 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 15 replies, has 2 voices.

Last updated by Minesh 2 years, 5 months ago.

Assisted by: Minesh.

Author
Posts
#2411443
Propertie in ter apel.png
Place nearby.png

Hi there,

I want to know if it's possible to show places (uitstapjes in de buurt) nearby my Properties on a map.

For example, I have a propertie 'Huisje in Ter Apel' in Ter Apel and I want to show everything within a certain radius around the map like 'Museum Klooster Ter Apel'.

#2411467

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Have you checked the following Doc:
- https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/

Is that the requirement for you is when you display a single post 'Huisje in Ter Apel' on frontend on single post you want to display the related posts that falls nearby address which is hold by the post 'Huisje in Ter Apel' with custom field address value.

That means you want to display other posts on map that is near by the current post's address field value - is that correct? If yes, to display posts related to the address hold by current post's custom address field, you will have to add distance search with fixed address and later you can use the view's hook "wpv_view_settings" to pass the address field value of current post.

Please check the following related ticket that may help you:
- https://toolset.com/forums/topic/display-view-of-nearby-places-relative-to-the-current-view-using-block-editor/page/2/#post-1896009

#2411539

That means you want to display other posts on map that is near by the current post's address field value - is that correct? If yes, to display posts related to the address hold by current post's custom address field, you will have to add distance search with fixed address and later you can use the view's hook "wpv_view_settings" to pass the address field value of current post.

Yes this is correct. So this is dynamic for every post? Can you show me how to to it? My PHP knowledge is not that good.
Where do I add the add distance search with fixed address, do I have to create a new view and add it here?

#2411571

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can add the custom code to "Custom Code" section we offer.
=> https://toolset.com/documentation/programmer-reference/adding-custom-code/using-toolset-to-add-custom-code

If you can share problem URL where you want to display the map and based on what field I'm happy to setup for you,

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2413635

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

sorry but I'm bit confused.

I see you shared reference URLs that belongs to another domain: hidden link

The access details you shared is belongs to domain: hidden link

So, on the domain for which you shared access details ( hidden link) on what post/page you would like to configure the distance search and compare to what field you want to display places near by.

It seems that what you want is, when we are on single post page: hidden link
- We need to take the address field value of above post "huisje-in-ter-apel-3" that is "Ter Apel, Groningen, Nederland"
- Based on that address field value "Ter Apel, Groningen, Nederland", we need to find the near by post within the post type "uitstapjes"

Is that correct?

#2413841

- We need to take the address field value of above post "huisje-in-ter-apel-3" that is "Ter Apel, Groningen, Nederland"
- Based on that address field value "Ter Apel, Groningen, Nederland", we need to find the near by post within the post type "uitstapjes"

Yes that is correct.
And for hidden link
- You need to take the address field value of above post "Groepsaccommodatie Klonie Ellertshaar" that is "Ellertsweg 4, 9535 TA Ellertshaar"
- Based on that address field value "Ellertsweg 4, 9535 TA Ellertshaar", we need to find the near by post within the post type "Huisjes huren

#2415311

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see on the page you already added a map that shows the post's address:
=> hidden link

Do you want to add another map that should display the near by address belongs to current post address?

#2415951
HeerlijkHuisjeHuren.png

Yes I want to use the map that show 'Huisje in Ter Apel' and the show the 'uitstapjes' near by address belongs to current post address on the map and a image and title below. See image that I uploaded.

#2415997

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please check now: hidden link

I've created the following view:
=> hidden link
Where:
- I've added the Distance query filter (you can modify the distance radius by editing the query filter, currently its set to 50km, so the posts belongs to post type 'uitstapjes' that should fall within the radius of 50km will be displyed. ):

Distance
Show posts within 50km radius of address/coordinates provided using mapcenter shortcode attribute.

In the loop output I've also added the distance value so you can see the distance difference from the current post address to the 'uitstapjes' post address field:

<p>Distance: [toolset-maps-distance-value location="[types field='adres'][/types]" postmeta='wpcf-address' postmeta_id='$current_page']

To add the markers to the map you have, I've added the following marker shortcode within the loop editor:

     [wpv-map-marker map_id='map-5' marker_id='marker-[wpv-post-id]' address="[types field='adres'][/types]" marker_title='[wpv-post-title]' marker_icon='//heerlijkhuisjehuren.nl/wp-content/plugins/toolset-maps/resources/images/markers/Buildings.png'][wpv-post-title][/wpv-map-marker]

You can format the Loop Editor section to display the output as required.

Then I've added the above view using the Fields and Text block just below the Map you added:
=> hidden link

[wpv-view name="show-places-nearby" mapcenter="[types field='address'][/types]"]

I hope the above solution I shared will help you to resolve your issue.

More info:
=> https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#toolset-maps-distance-value
=> https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#wpv-map-marker

#2416299

Super, thanks!

Can you also do it the other way around so that you see the 'Huisjes huren' nearby museum-klooster-ter-apel?
hidden link

#2416585

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I already show you the way how to do it. Would you mind to take a chance to build it on your own that way you will know how to do it. If you need help I'm here.

#2418181

My issue is resolved now. Thank you!

#2420545

Hi Minesh,

Today I want to add some 'uitstapjes' but the radius is not working.
I haven't changed anything on my website, can you see where it goes wrong?

hidden link

#2420553

Hi Minesh,

Today I want to add some 'uitstapjes' but the radius is not working.
I haven't changed anything on my website, can you see where it goes wrong?

hidden link

#2420555

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Could you please share admin access details as when you resolve the ticket the shared admin access private details will be automatically removed.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.