Skip Navigation

[Résolu] Having problems filtering something that is set to "any of the following"

This support ticket is created Il y a 7 années et 4 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. 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)

Marqué : 

This topic contains 6 réponses, has 2 voix.

Last updated by jasonH-4 Il y a 7 années et 4 mois.

Assisted by: Nigel.

Auteur
Publications
#459636

I am trying to set up a filter on my view using checkboxes.

At the top of my View, I have a Query filter on a taxonomy for CONTENT TYPE set to "any of the following" because I want to exclude certain items in that taxonomy from appearing in the list.

A second taxonomy for AUTHORS is set to "all of the following".

Basically, it's selecting an AUTHOR, let's say "Bob Jones" and show ALL of his CONTENT TYPES in ANY of the following categories (taxonomy items): books, videos, plays - but unchecked are Bob Jones taxonomy items: magazines, web articles, etc.

So, basically, when I use the filter editor on the ANY taxonomy CONTENT TYPE (using checkboxes), it doesn't work. But if I change CONTENT TYPE to "ANY OF THE FOLLOWING" to "Set by one URL parameter" in the Query FIlter, it DOES work, but then it also shows those magazines and web articles I don't want to appear in this view show up.

I hope that makes sense.

Thanks!

#459720

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

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

Screen Shot 2016-11-23 at 08.35.18.png

Hi Jason

I set up a quick test to replicate this and I couldn't see the problem, but I may have misunderstood the issue.

I made a View called "Plays and Books by Bob".

I added taxonomy filters for author and content type as shown in the screenshot.

I added this view to a page and it output a list of plays and books by Bob, no other content of Bob's, and no content of Will's.

If I have misunderstood can you elaborate?

#460035

Hi Nigel,

Thanks so much for doing a quick test. I believe you've only done the first part.

Now use the Filter Editor to make a filter there using checkboxes for your "Content Type" taxonomy. When I do this and have the Query Filter above to "any of the following", the checkboxes don't work when they are checked (they don't filter on the page). The checkboxes DO work if I have the Query filter for "Content Type" set to "Set by one URL parameter".

Very curious to know if you will have the same problem that I am having!

#460067

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

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

Hi Jason

OK, it seems you are trying to add both Query Filters and search (parametric) filters.

When you create a new view and specify that it is a custom search the UI for Query Filters is purposefully hidden. That's because you can't add a query filter for something (e.g. a custom field) and also add a search filter for the same thing, they will interfere with each other.

You can have a Query Filter for one thing and a search filter for something else, but not both for the same thing.

That's what I have understood you are trying to do, but correct me if I'm wrong.

#460294

I'm not quite sure I understand. I have plenty of views set up where I can use checkboxes to do a search to further narrow a taxonomy set up in the taxonomy filter. Nothing in the Query "Taxonomy" Filter is hidden when I edit the search filter, is it? Doesn't seem to be.

I don't see it as searching for different things, but maybe I'm not getting it. The query taxonomy filter filters the custom type to show the taxonomy CUSTOM TYPE to show only "books" and "videos" and "plays" (but not "magazines").

I want to use the search filter to be able to use checkboxes so users can see ONLY "books" if they want. It seems to me like it's a further filtering of the same thing, not a different thing, but maybe it's impossible.

#460391

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

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

Views is basically a wrapper for the native WP_Query, which queries the database to retrieve posts according to the arguments you supply.

When you set a Query Filter in a view that is 'permanent', it is effective every page load.

When you add a custom search filter, that works by adding a url parameter and refreshing the page. The presence of that url parameter prompts the view to add that filter as a search argument.

If you use the same 'thing' (e.g. taxonomy, custom field) for the Query Filter and the custom search filter then once the page is refreshed with a url parameter present it is trying to apply both, possibly conflicting, rules for the same thing.

Let's say the results may be unpredictable and doing this is unsupported.

If you create a new View and specify that it is a custom search then the UI for adding a 'permanent' Query Filter directly is hidden, you can only add the parametric filters using the New Filter button in the Filter Editor, unless you change the screen options at the top to expose the Query Filter section (or if, when creating the View, you choose to set up options manually).

You would expose the Query Filter section if you wanted to add a permanent filter for one 'thing' (taxonomy, custom field etc., perhaps 'author' in your case) while having parametric filters for other things.

It sounds like you want to pre-select some of the search terms your users might select, so if there are taxonomy terms 'books', 'videos', 'plays', 'magazines', & 'web articles' and you want the page to load with the first three of those pre-selected, then bear in mind that with a custom search these are set by the url parameters.

So, if you add this view using just custom search filters to a page and visit it. Now select the terms you want to pre-select. The page will update the url to include the search terms with a parameter 'wpv-category-slug'. There will also be additional parameters that you can remove. If you copy that url then you can use it wherever you link to this page so that those terms are pre-selected when the user first visits it.

I hope that helps you achieve what you are looking for.

#461463

Thanks for explaining that - I was thinking things were more flexible than they are so it's good to understand the limitations. I appreciate you taking the time to explain it to me.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.