I am trying to:
Add a search filter by distance to a view.
Link to a page where the issue can be seen: hidden link
I expected to see:
The filter save when I click the button.
Instead, I got:
Nothing. I had the same problem in the last distance filter I used. I had to add it from the block editor, but now I can't remember where to add it from there. I'm hoping the sidebar filter can be fixed so it saves.
On a related note, I'm also trying to filter a view by distance, but the address is from a related post type. In other words, I'm showing a products view and it has the address from the store post type that they are located at. I'm attempting to use this related address field for the map, but it is not working. If you would like a video of this let me know your support email since I can't upload it here.
Do you mean that you have post type X and post type Y with post relationship (one-to-many or many-to-many). And you created a view to display posts belongs to post type X and the map address field for which you want to add distance filter is belongs to post type Y. Is that correct? If yes:
- You can add only fields as frontend filter to your custom search that is belongs to the post type you set your view to query. So, if in your case you set your view to query post type X then you can not add the frontend filter using field that belongs to post type Y.
In some cases - it could be possible to share workaround if possible using custom code but to know if its possible or not we will require to review your current setup. Can you please share what address field you want to use and if I search with XX address what would be your desired result.
Once you share all above required information I will be happy to review your current setup.
Yes, you are correct. I do have 2 separate issues, though.
1. Filters will not save from the settings in the sidebar in *any* view I create. I think this is a bug.
2. To answer your question: "Can you please share what address field you want to use and if I search with XX address what would be your desired result."
I have 2 related CPTs:
1. Products
2. Locations
I want to build a product search that shows all products within 50 miles of an address. A good address to try would be:
417 Spaulding Rd, Montezuma, GA 31063
I am using a products view that pulls an address field from the related locations CPT. I want the results to be displayed on a map as well as in a view. Let me know if you need anything else from me.
I've adjusted the view with your page as you can see here: hidden link
- I've set the parent view to query the "Distributors" post type and within the loop I've added another view using the content template and I've added that content template shortcode using the shortcode's block:
That's great! Thank you so much for your help. What you did demonstrates a different way of approaching this design, one that I might not have tried on my own. Question: How did you get the filter to save? One of my issues was I couldn't get the filter to save. I must be doing something wrong. Please see the following video:
When you add filter the related query filer will be automatically added and that is why you wont able to save it. Glad to know that the solution I shared help you to resolve your issue.
You're welcome to mark resolve this ticket. Have a great day ahead.
Thanks again. In the link to the video I posted in my last comment (hidden link) I'm using a different page set up to not use the relationship. It's just a simple distributor search, but it's still not saving. I can't get a filter to save at all for any view. Here's the test page:
I am actually able to save filters, just not for the Distance filter. I'm assuming I need to go through the tutorial again to make sure I did everything right. This issue is resolved. Thanks!