Tell us what you are trying to do?
I am trying to generate a list a posts that are within x distance from the item being shown. For example, I have a custom post and template for a hotel that has an address. I want to show all restaurants within a certain distance from the hotel on the template. I cannot seem to get the filter to use the hotel address as the comparison address for the distance filter. I am pretty sure you would be able to do this I am just not sure how. I would also love some guidelines/examples for what goes into the fields "Distance (center, radius, unit) URL parameter to use" on the distance filter.
Thank you!
Hello,
You can use Types shortcode to get current post address field value, for example:
[types field='my-address' item='$current_page'][/types]
https://toolset.com/documentation/customizing-sites-using-php/functions/#address
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/
And pass above value as Views shortcode attribute, see my screenshot: distance-filter.JPG
Show posts within XXkm radius of address/coordinates provided using mapcenter shortcode attribute.
Here is the document for "Filtering and Ordering Map Markers by Distance in WordPress"
https://toolset.com/course-lesson/filtering-and-ordering-map-markers-by-distance/
For your reference.
Thank you for your response. My distance block looks different than the one you sent a picture of - do I need to update? Looks like I have the latest.
I tried putting 'mapcenter' into the field but nothing worked. Where do I type in the shortcodes? I haven't been able to find where those go.
Thank you!