# Ajax Filter Sort

**Lets users sort results by different criteria.**

**Content > Query Settings**

| Setting          | Description                              |
| ---------------- | ---------------------------------------- |
| **Query Name**   | Must match your Main Query               |
| **Sort Options** | Define available sort options (repeater) |

**Sort Option Settings**

Each sort option has:

| Setting         | Description                                                                 |
| --------------- | --------------------------------------------------------------------------- |
| **Label**       | Display text (e.g., "Newest First")                                         |
| **Source Type** | Built-in Field, Custom Field (Text), Custom Field (Numeric)                 |
| **Field**       | For built-in: Title, Date, Modified Date, Menu Order, Random, Comment Count |
| **Meta Key**    | For custom fields                                                           |
| **Order**       | ASC or DESC                                                                 |

**Content > General Settings**

| Setting               | Description                               |
| --------------------- | ----------------------------------------- |
| **Layout Type**       | Dropdown, Radio, or Button                |
| **Placeholder**       | Dropdown placeholder                      |
| **Hide 'All' Option** | Hide default/reset option                 |
| **Label: All**        | Text for default option (e.g., "Default") |
| **Legend Label**      | Accessibility label                       |
| **Apply On**          | Input or Submit                           |

**Default Sort Options**

The element comes with these presets:

* Newest First (date DESC)
* Oldest First (date ASC)
* Title A-Z (title ASC)
* Title Z-A (title DESC)

**Usage Example**

```
Product Sort:
1. Add Ajax Filter Sort
2. Query Name: "products"
3. Sort Options:
   - "Price: Low to High" | meta_value_num | _price | ASC
   - "Price: High to Low" | meta_value_num | _price | DESC
   - "Newest" | built_in | date | DESC
4. Layout: Dropdown
5. Placeholder: "Sort by..."
```
