Skip Navigation

[Resolved] Ordering with checkbox functions as filtering

This support ticket is created 4 years, 11 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.

Our next available supporter will start replying to tickets in about 1.00 hours from now. 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)

This topic contains 2 replies, has 2 voices.

Last updated by katjaL 4 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#1406289

I would like to show first the posts which have certain checkbox, let's call it "First", active. Now if I set it as "Ordering->Order by-> Field - First, the view shows only the posts that have the field activated. Is this intentional or do I have some misconfiguration somewhere? There's no secondary sorting.

#1406755

Nigel
Supporter

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

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

When you order by some field, any posts that have no value for that field will not be included in the results.

That's not something specific to Views, it is how WordPress works (because of how MySQL works).

So if your checkbox field saves nothing when unchecked, all such posts will be omitted when ordering by this field.

Update your field settings so that it saves zero when the checkbox is unchecked. That will require you to re-save all such posts for the database to be updated.

Then the ordering should work, let me know otherwise.

Note that there is a known issue with saving zero when unchecked for the checkboxes field type, which you should avoid, but with the checkbox field it should work okay.

#1407213

Thank you Nigel very much for this information!