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 records ordered by one of the staff member fields.
How to add a custom sort option.
- Choose one of the staff member fields to be used for sorting.
- Field type has to be: Single Line Text.
- Add option: c-sort”F4″ to the shortcode.
- F4 is the field number. Replace it with the number of the field selected in step 1.
- Field has to be populated with the data you want to sort by.
- Open the staff page. The records should be sorted alphabetically by the content of the sort field.
You can use any field as long as it’s of Single Line Text type.
It can be visible or hidden field (Hide/Delete template setting).
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.