I have a cpt Places, each with an address field, and am trying to display the closest 3 Place to this cpt in a section on my page "Other Bars Closest to..." that displays a legacy view ordering by the cpts address field, "as a distance from" toolset_maps_distance_center
You can see this view being displayed at the bottom of this page:
If you put the address of this place into the address search field "Nguyen Dinh Chieu 69 Mũi Né, Bình Thuận " it produces the desired results. So essentially I just need this field pre-populated with the current cpts address field and for it to run on page load.
This seems like it should be an easy way to do this because it's such a useful feature and I can get so close with my current configuration.
Sorry, I should have mentioned that I previously did follow the ticket you mentioned, and that is how I got this far. I have added that code to my functions file and I have the Ordering setup like the screenshot from that ticket, and added this to my template:
2. Next, in the view's "JS editor", I've included the following custom script, that reads the address from the hidden container from step 1, fills it in the location center search field and then triggers the search automatically, when the page loading completes:
Awesome thanks. This does work to populate the search field, but it's not triggering the search automatically. You can see that when you click into the address field and press enter, then the closest locations appear(you can see with the km numbers)