[Resolved] Ordering with checkbox functions as filtering

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.

This topic contains 2 replies, has 2 voices.

Last updated by katjaL 3 months, 2 weeks ago.

Assigned support staff: 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!