I have a view to show clinic results based on a country. The results work well in terms of showing the clinic results that match the country the view is shown on.
However I have a filter dropdown to filter the results on the page, one filter is to show the city within the country. The problem I'm having is if a clinic listing is assigned two different countries via a taxonomy, the filter will then show cities in other countries as well.
How can I filter the filter itself so it won't show other cities outside the current country being shown?
Hello. Thank you for contacting the Toolset support.
Well - could you please share a test case example where exactly you want to exclude which post. maybe a test case example with access details will help me to understand better and what is your expected output.
*** 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 would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).
I have set the next reply to private which means only you and I have access to it.
Well - I see you are using taxonomy archive page - I would like to know here are you using custom search with taxonomy archive page or you added a view to your taxonomy archive page?
Can I have wp-admin access so I can review how you setup your archive?
I've created a custom taxonomy "country" and the view is inserted into the country archive page using PHP.
Since the views filter is set to filter listings tagged with terms from that taxonomy it should work. The posts themselves are filtered without a problem.
The issue is the dropdown is adding in other cities that are also associated with that listing, but are not in the same country currently being displayed That should not occur.
Well - based on screenshot you shared I see you have state and city taxonomy filters added. You are displaying taxonomy archive for "belgium" so, I would like to know here how you relate the Country -> State -> City?
How you are relating the Country -> City? I mean how do we know that this city is belongs to this country?
However, there is no such filters available to filter the taxonomy filters but still I would like to know above information and I will see if there is any possible solution for this.
I now realize there is no way the system would know that malaga is in Spain not Belgium since the two taxonomies are not connected. So maybe there is some other way of implementing this?
Yes - all clear, all I wanted to know is the relation between the Country and City taxonomy but there is no relation.
I do not have anything to offer here as there is no way to know which city belongs to which country. You have setup your taxonomies City and Country without having any relation between them.
This needs custom programming which is beyond the scope of our support policy. If you need custom programming for your project, please feel free to contact our certified partners.
=> https://toolset.com/contractors/
However, in addition to this, there is no such filters available to filter the taxonomy filters you add to views until you go for custom programming approach.
Ok well thanks anyway. I'm going to try adding a meta field to the city taxonomy where I can save the associated country and hopefully I can filter using that.