Skip Navigation

[Resolved] Custom text in checkboxes field filter options

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

Problem: I have a checkboxes group custom field created in Types. I would like to use this checkboxes group as a filter in a custom search View, but I would like to use custom text for each option instead of the text shown in the custom checkboxes group field settings for each option.

Solution: Use the wpv-control-postmeta shortcode to create a custom filter with custom text for each option.

[wpv-control-postmeta field="wpcf-fieldslug" source="custom" url_param="wpv-wpcf-fieldslug" values="1,2,3" display_values="*,**,***"]

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#vf-520693

This support ticket is created 4 years, 7 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 5 replies, has 3 voices.

Last updated by wimD-3 4 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1940559

Tell us what you are trying to do? Get the filter of my view to work again.

Is there any documentation that you are following? Unable to find anything on this issue.

I have created a custom content type with 10 fields of 4 checkboxes (a star rating from 3 stars to none). I used these fields as filters for a view (View legacy plugin, because I use another page builder than Gutenberg, so blocks is not an option). The last checkbox, 'none', did not seem very useful, so I deleted that option (going from 4 checkboxes to 3 for each field). As a result the search filter broke and it remains broken. The filter behaves strangely and no results are found, no matter which option I choose.

Is it normal for a filter to break when something is changed at the back-end? How can I avoid this from happening, keeping in mind that sometimes you need to correct something in the back-end after you made a filter. In this case there was a checkbox too much, but it could be that checkboxes would need to be added later on when the site grows or the concept changes.

Thanks for the help!

#1940565

And also: how can I get the filter of the current views working again?

#1940731

Nigel
Supporter

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

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

Hi Wim

I'll think we'll need to be able to access your site to look into the problem. If you don't have a staging site, we might also need to make a copy of the site to test locally, if that's okay.

Let me mark your next reply as private to get log-in credentials from you—you may want to create a temporary admin user for us to use that you can later delete. And be sure to have a current backup of your site.

Please give details of the problem View and the affected checkboxes fields.

#1941037

Hi Nigel

Thank you for your reply.

Before receiving your reply, I decided to apply a backup to get the site back to the state where the filter still worked. I re-took all the steps I had taken before to see where and when the issue occured. I thought the issue occured after deleting one of the checkboxes, but now I have found that the it was caused by changing the titles of the checkboxes. I wanted to make them clearer and thus more user friendly, so I added the stars rating to them in HTML and that's where it went wrong. I shouldn't have used HTML.

Is there a way to replace the title of the checkbox in the front end filter, so I can still achieve what I want?

Thank you,
best regards,
Wim

#1941465

Hello, yes you can use the custom source and custom value attributes in a wpv-control-postmeta shortcode to set arbitrary values and text labels for each checkbox option. Here is an example showing how to use * characters to represent stars in the checkbox labels:

[wpv-control-postmeta field="wpcf-fieldslug" source="custom" url_param="wpv-wpcf-fieldslug" values="1,2,3" display_values="*,**,***"]

Or, you can use custom CSS to hide the text and show images that represent the multiple star rating values. If this isn't what you had in mind, please provide a URL where I can see the View and describe what you'd like to achieve in more detail. A screenshot would be helpful.

#1945091

My issue is resolved now. Thank you!