Skip Navigation

[Resolved] Creating a View Based on a Checkbox

This support ticket is created 5 years, 6 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
- 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 2 replies, has 2 voices.

Last updated by chrisB-30 5 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#1254021

Hello,

I am trying to create a view that only shows entries that have a checkbox checked.

I have a custom field type "checkbox"
hidden link

Here is my filter I am using in the view:
hidden link

And I inserted this shortcode into my post:
[wpv-view name="staff-favorites"]

What am I doing wrong here?

Thanks

#1254075

Nigel
Supporter

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

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

Hi Chris

What's happening, all posts are being shown and not just those with the checkbox checked?

- double-check your posts so that you are sure only some of them have the checkbox checked
- go to Toolset > Settings > Front-end Content and turn on Views debugging (full)
- visit the View on the front end and from the debug pop-up show the "filter arguments before the query using wpv_filter_query"

You should be able to verify that a meta query for your custom field is included, something like

    [meta_query] => Array
        (
            [0] => Array
                (
                    [key] => wpcf-staff-favorites
                    [value] => 1
                    [type] => CHAR
                    [compare] => =
                )

            [relation] => AND
        )

#1254867

My issue is resolved now. Thank you!