Custom Sort Order (Staff Order)
WordPress Plugin Staff List – Custom Sort Order
Default Sort Order
Records are sorted in alphabetical order by the Sort Text field, usually populated by Last & First names. This is the most popular and a default option. It’s designed to provide the best performance, especially in case of large number of staff members.
Custom Sort Order
A custom sorting is a convenient way to to implement a special sort order that default ordering option can’t accommodate. You can display a subsets of records filtered by category and ordered by custom field (e.g., position or job title).
How to add a custom sort option.
- Add a new input field (Template > Input Fields).
- Field type has to be: Single Line Text.
- Yo can change the field visibility to hidden – Hide/Delete setting.
- Add option: c-sort”F4″ to the shortcode.
- F4 is the field number. Replace it with the number of the field you’ve created in the step 1.
- Populate the field with with text you want to sort by (Staff Member records).
- Open the staff page. The records should be sorted alphabetically by the content of the sort field.
You don’t have to create a new field. You can use any existing one as long as it’s type of Single Line Text.
Hiding the field is optional. Visible fields will work as well.
How to specify the sort direction.
When custom sort is implemented staff members are sorted alphabetically by:
- First: Content of the custom sort field. Ascending order.
- Next: Sort Text field. Ascending order.
Data sorting is not limited to ascending order (from A to Z). Although this is the default, the shortcode attributes can modify ORDER BY clause to sort in descending order (from Z to A). To sort by descending order the keyword DESC must be specified.
c-sort-order=”DESC” Custom field.
order=”DESC” Default Text Sort field.
Ascending order is the default one and doesn’t require any shortcode attributes.