By default Connections will sort by last name [organization name, family name], first name in descending alphabetic order. The order_by attribute can be used to apply a custom sort order. Here are the available sort fields and order flags that ca be used.
**NOTE: The SPECIFIED and RANDOM Order Flags can only be used with the id sort field. The SPECIFIED flag must be used in conjuction with the id shortcode attribute which must be a comma delimited list of entry IDs. If this is set, other sort fields/order flags are ignored.
Multiple sort fields can be used by separating them by commas. You can also add the order flag to each sort field to list the results in ascending or descending order. The sort flag is entered right after the order field separated by a ‘pipe’ | . This character is usually placed above the ENTER key and typed by hitting SHIFT + BACKSLASH keys.
/* * Example 1 * Sort by state in ascending order and then zip code in descending order. */ [connections order_by='state|SORT_ACS,zipcode|SORT_DESC'] /* * Example 2 * Sort by entry ID but list them exactly in the order as entered in the id attribute. */ [connections id='5,401,10,36' order_by='id|SPECIFIED'] /* * Example 3 * Sort all results randomly. */ [connections order_by='id|RANDOM'] /* * Example 4 * List the supplied entry IDs but order them randomly. */ [connections id='5,401,10,36' order_by='id|RANDOM']