Skip Navigation

[Resolved] Pre filtering a view

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to pre filter their view so that only specific products will be displayed using that view.
Solution:
If you are using our Block builder then you should be able to see a query filter in the Content selection section under the Block tab.

This query filter section should allow you to create a static filter that is based on any post attribute such as custom fields or taxonomy.

This support ticket is created 2 years, 9 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by dominiqueM-3 2 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#2099253

Tell us what you are trying to do?

Hello,
I am working on a product catalog.
Each product belongs to a specific category. There will be 2 categories of products.
I want to display each product category on a specific WordPress page.
For a category, I want to display a search filter to filter the products against the values ​​of 3 custom fields.

Here is my question:
Do I have to create 2 custom post types, one for each product category or can I work with a single “product” custom post type with a taxonomy for categories?
For the latter case, can I pre-filter the view against the category? Could this pre-filter still be active even after searching from the search filter?

Thank you

#2099311

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Dominique,

Thank you for getting in touch.

If I understand correctly you want to have 2 separate pages with a view that are pre-filtered by 2 different categories on the product post type and then each page should have a filter for the custom fields that are on the products?

Example if I have we have the post type called Product and 2 category called Red and Blue. On Page 1 you only want products that are Red and on page 2 you only want products that are Blue correct?

Then you want to filter those different pages further using the frontend filters for the custom fields that are on the products.

For the latter case, can I pre-filter the view against the category? Could this pre-filter still be active even after searching from the search filter?

Yes you can have the pre-filtered category and then the prefilter will still be active given that you don't need that category filter as a frontend search field.

I'm assuming here that you're using the Block builder to create your view.

Thanks,
Shane

#2099363

Hi Shane,

Thank you for your reply.

How should it be done concretely.
I'm thinking about creating a search filter with a pre filled field with the category name.
This field should be hidden for the user.

Is it the right way?

Thank you

#2099515

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2021-06-25 at 2.14.00 PM.png
Screenshot 2021-06-25 at 2.13.36 PM.png
Screenshot 2021-06-25 at 2.12.50 PM.png

Hi Dominique.

If you are using our Block builder then you should be able to see a query filter in the Content selection section under the Block tab. See Screenshot

What you're going to do is to click the Add a Filter button to add your static filter for the taxonomy. See Screenshot

From this screen just select the taxonomy term that you want to filter the view for. Only posts that have the selected term will be returned.

Thanks,
Shane

#2101463

Thanks Shane for showing me the solution.

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