Skip Navigation

[Resolved] Filtering the results of a dropdown filter

This support ticket is created 6 years, 3 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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 8 replies, has 2 voices.

Last updated by Farrel 6 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1095974

Hi

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?

Thanks

#1096153

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1096864

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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?

#1096932

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.

Isn't there something we can do with a filter?

#1096951

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1096955

This is how it works. I have two custom post types. "Doctor" and "Clinic". Then I have two custom taxonomies, "country" and "city"

In this case the doctor and clinic have a location in malaga (city) > spain (country) AND "brussels" (city) > belgium (country)

So the post is assigned to the city taxonomy with two different cities, and to the country taxonomy with two different countries.

On the Belgium page is should only filter by the country belgium. I need to filter out malaga because its not a city in Belgium but in Spain.

Is this clear now?

#1096956

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?

Any ideas?

#1096962

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

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.

#1096972

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.