Skip Navigation

[Résolu] Custom field filter for checkboxes type field

This support ticket is created Il y a 3 années et 6 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

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

Last updated by Waqar Il y a 3 années et 5 mois.

Assisted by: Waqar.

Auteur
Publications
#1824359

I have a Checkboxes custom field - hidden link

In Views, how can I filter the results based on the checkboxes?

I am looking to filter the results by passing a value via the shortcode attribute.

Is this possible?

#1824367
#1828113

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Stanley,

Sorry about the delay in getting back on this.

I had an unusually busy forum queue, but I'll be able to share my findings, by the end of the day today.

Thank you for your patience.

regards,
Waqar

#1828947

No worries. All good.

#1831541

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

filter-settings-example.png

Hi Stanley,

Thank you for waiting.

During testing on my website, I was able to make this filtering work, by using the raw value (i.e. the value saved in the "Value to store" field), as the passed attribute value for each checkbox option.

The attached screenshot shows the query filter settings and the shortcode for the view will look like this:


[wpv-view name="view-slug" type="abc"]

Note: You'll replace "view-slug" with the view's slug and "abc" with the target raw checkbox value to filter by.

regards,
Waqar

#1831579

I tried this and it can only filter by the first checkbox option.

When I tried putting in the second, third, etc checkbox option, it shows no results.

For example,
[wpv-view name="view-slug" type="abc"] - This shows a result.
[wpv-view name="view-slug" type="def"] - This doesn't a result.
[wpv-view name="view-slug" type="xyz"] - This doesn't a result.

#1834039

Waqar
Supporter

Languages: Anglais (English )

Timezone: Asia/Karachi (GMT+05:00)

I've tested this before and I did some further tests again, but couldn't reproduce this behaviour on my test website.

Here is how my checkboxes custom field is set:
screenshot: hidden link

This is how, I've added the shortcode for the views in the backend:
screenshot: hidden link

And here is the screenshot of the output of these shortcodes, from the front-end:
screenshot: hidden link

I'll recommend to test the view again and if the issue still persists, please share specific page where the issue can be seen.

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