[Resolved] Toolset Maps Distance function not working
This thread is resolved. Here is a description of the problem and solution.
Problem:
The Maps distance filter is added to an archive custom search but is not working.
Solution:
The distance filter is not currently supported on archive pages. You can create a View with similar search functionality and insert that onto a static page and use that in place of the archive.
This support ticket is created 6 years, 7 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.
Add the ability to search for events within a certain radius of a specific address
Link to a page where the issue can be seen:
hidden link
I actually removed the code for now, because it wasnt working, but you are more than invited to give it a try yourself.
Do you need the login credentials?
I expected to see:
All the events that are located within the given radius.
Instead, I got:
I did see the option to enter a specific address and a specific radius. But upon submission, it was not delivering results.
It is difficult for me to diagnose the problem if I cannot see it, so I suggest you create a test page on your site that you add a new test View to where I can see the problem (both on the front end and the back end—I'll get site credentials from you).
For this to work your posts should have a Types address field with their location.
You create a View to display these posts, including a map shortcode in the Loop Output section outside of the wpv-loop tags, and a corresponding marker shortcode inside the wpv-loop tags.
That would display all results on a map.
You then also need to insert Filter Controls for distance which will allow you to show posts within a specified radius of a location: this is the part that isn't working, correct?
If you set up a test View inserted on a test page I can try and see why not.
I'll mark your next reply as private so I can get site credentials from you (you can ignore the FTP credentials). Please make sure you have a current backup.
In any case, I restored what I previously did, so you can have a look. I didn't use maps or sorting options.
All events in the database have a certain address (Types address field), and all I did was to add the Distance option, as you are now able to see here: hidden link
I don't work with Views, but an archive template instead. I dont use a map shortcode either in the loop section. Perhaps this is the "missing link"...?
OK, that would be the problem. The distance filter is not supported in WordPress archive custom searches yet.
If you wanted this to work with a distance filter, you would have to create a View instead and then insert this View onto a standard page.
If you wanted to use the same URL as you currently use, you could disable the has_archive option for your post type so that there was no collision between the page URL and the archive URL.
Thanks for this. Works like a gem now.
Not sure if this needs to be addressed in a new ticket, but I have one more question regarding the filters in the new page I made; hidden link
There are two filters on the right; Start datum and Dag. These two should ideally not be displayed simultaneously, but should be dependent on the filter in the middle, named Frequentie.
If a visitor chooses one of the two values, then either Start datum OR Dag should be displayed. I tried to accomplish this with the Conditional Output functions (Filter Editor), to no avail.
Is this possible at all?
Best regards,
Ruud
New threads created by Nigel and linked to this one are listed below: