Skip Navigation

[Resolved] Filtering all views on all pages set by one custom filter

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

Our next available supporter will start replying to tickets in about 7.34 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 13 replies, has 3 voices.

Last updated by Tony Stirrup 6 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#592142
events page screen.png

Tell us what you are trying to do?

I have various types of content displayed across several pages using multiple views. They all share a Taxonomy of 'Country' which indicates which countries the content is relevant to (for example, 'events' may be only running in one country).

I want to set up a 'Select Country' dropdown in a top banner which will filter any views where I embed the country filter (probably all of them).

Is there any documentation that you are following?

Read lots of docs and support questions which seem similar but I still haven't figured it out. I'm sure I'm missing something simple but I'm spending too much time trying things out. Thanks for your advice.

ocncloud currently has a non-working, poorly formatted version of what I'm trying to achieve.

#592361

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - you can display only search form using widget "WP Views Filter".
=> hidden link

Now, regarding adding filter that apply to all views the idea here is to add your taxonomy filter with url param and add "Query Filter" for all your view filter by taxonomy by URL param as instructed with following link. Make sure that URL param name should be same for all view filters.
=> https://toolset.com/documentation/user-guides/passing-arguments-to-views/
[Section: "Filters by taxonomies"]

More info:
=> https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

Does this help?

#593404

Thanks Minesh. I’m actually using exactly this technique to filter the taxonomy pages with multiple views which works well.

However it only works as the user submits the filter. I need something that a user selects once and then acts as a filter on all subsequent views. Example: the user selects UK and will only see output that has UK selected in the Country taxonomy. All ideas welcome. Thanks.

#593407

Minesh
Supporter

Languages: English (English )

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

The suggested approach is the only way to filter multiple views using single filter. It is not possible to filter multiple views based on AJAX filter as it will only update the output to which view the filter is associated.

#593560

Thanks Minesh. I don't think I am explaining myself very well. I have figured out both the ajax filters and the filter by URL param to multiple views. Your documentation was very helpful there. Perhaps this is out of spec for your support but let me try once more with a step by step example. If we can't answer it then I'll leave it.

1. User enters site and uses a drop down/checkbox mechanism to select their Country (from UK, USA, EU)
2. As they navigate the various pages, each view includes a filter which only shows posts relevant to the Country selected.
3. Other filters use Ajax to further filter on types of content, categories taxonomy, etc.

I have used several pages with multiple views and can easily do step 3. In fact I can use a Country taxonomy and add a Country filter in the same way. But this means that a user has to repeat the Country filter every time they move page.

I found some other stuff on your posts about global variables including:
https://toolset.com/forums/topic/setting-global-variable/ which has a similar requirement. I can possibly use this to filter every view on a global variable. Is there any way to use Types to let a user set the value from the front end?

Many thanks for your support - and for bearing with my poor explanations!

#593979

Minesh
Supporter

Languages: English (English )

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

I understand your issue very well but the thing is that we can not trigger AJAX request for multiple views based on single filter as Ajax filter associated with particular view and it will update the view to which the filter is associated.

I'm not saying that its impossible but this needs custom programming that is eventually 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/

#593986

Thanks again Minesh.

I think perhaps it is me that doesn't understand my problem. I didn't see this as an Ajax issue. The Country filter would be set with a submit button and the filters would only be applied as the user enters a page by navigating to it.

Does that change things? If not then thank you for your patience with an amateur - this is the first time I have ever built a website - and I will close this thread.

Thanks.

#593987

Ahh - just thinking about your answer: is my problem because I'm mixing views that use other Ajax filters? I could switch them all to reload the page.

I still don't know how to set a variable which is always applied.

#593988

Minesh
Supporter

Languages: English (English )

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

Well - I can only tell now if you have test site where you implemented country filter and I know your exact flow.

Could you please describe step information and 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.

#596742

Hi Manish - sorry for this delayed response. I've been trying to organise this but it's taking too long. I do need to fix this issue but I have other priorities to get the basic website launched to deadline. I hoped this would be a quick fix but obviously it is more complex than I imagined. I have found a work around for the present by providing filters in a different way.

If I don't find an answer myself I will come back to you and reopen this issue.

Many thanks for your support - I really do appreciate the detail you go to.

Regards - TonyS.

#597143

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Tony

Minesh is on vacation, so I picked up his tickets.

Reading through this thread it seems to me that the issue is fairly straightforward, but that the solution lies just a little outside the scope of what Toolset can do without delving into custom code.

In your case, when the users selects a country I would set a cookie with that choice.

I would then add a little PHP that runs on the query_vars filter (https://developer.wordpress.org/reference/hooks/query_vars/) and checks if the cookie is present, and if it is adds it as a query var--equivalent to a URL parameter).

#597280

Hi Nigel - that's one of the workarounds - or as you say, a fix - I was looking at. Problem is I'm not a developer and have done everything so far with the theme and plugins, including your own excellent toolset. If I can't find a plugin for it, it won't get done in the short term. Mind you, I didn't know anything about CSS, wordpress or toolset before I started so I guess it's only a matter of time.

If you can recommend a plug in then great, otherwise we'll close this off until I have time to work through it.

#597621

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Tony

There isn't a plugin I can recommend because creating the cookie is just the first part of the issue, the second would be to use the cookie when it is present for the Views filter.

I've proposed adding a feature that the value for a filter can come from not only a URL parameter or shortcode attribute, but also from a cookie, which would leave just the question of setting the cookie in the first place.

We'll see if it gets accepted, but even if it does it is likely to be a while before it is implemented, so you would still need some PHP code to check for the presence of the cookie and then use it if present.

It shouldn't be too complicated, though I'd have to do some testing myself to be sure of what's involved.

Feel free to open another ticket if you want to have a crack at this some time. You are welcome to assign it to me and I'll try and give you a leg up.

#597701

Many thanks Nigel

I'll close this for now as you say while I investigate solutions. In fact, while I DON'T investigate as my priority at the moment is getting the basic site up and working! Many thanks to you and Minesh for your help.

Regards and thanks.