Changing or Adding New Sorting Options
This is one of the most powerful and underused features of GeoDirectory! With the Sorting options builder, you can create custom sort options based on your custom fields.
What are Sorting Options?
Sort options let you order listing results in a specific way. By default, listings are sorted by "Newest" meaning that newly added listings will be shown first.
Sort options can be used in many places including on archive pages and in GD > Listings widgets.
Some of the sort option features are;
- Most default fields can be used as a sort option.
- Most custom fields can be used as a sort option.
- Add as many different sort options as are needed.
- Enable a field to be a sort option by selecting "Include this field in sorting options" under the edit field > show advanced options.
- A single sort option can have many sorting factors.
- Any Sort option can be set as the default for that CPT.
- All sort options can also be used in the GD > Listings widget.
Adding or Editing a Sort Option
Each Custom Post Type (CPT) has its own separate sort options. Sort option settings are under the CPTs settings, Places > Settings > Sorting.
Let's create an example using our real-estate dummy data and add a new sort option that orders listings by the size of the property.
- The Area custom field should already be showing as an available sort type, click that to add it to the sort options.
You will then be presented with the settings for the sort option;
- Frontend title - This is the text used for the sort option.
- Ascending or Descending - Select the sort direction: (A-Z or Z-A)
- Default sort - This sets the option as the overall default sort value, there can be only one.
- Is active - Set if this sort option is active or not, if not it will not be shown to users.
We set the title as Largest Area (Sq Ft) and the sort direction to Descending (largest to smallest) and set it active.
Drag the sort option up or down to set the position in the list.
The results on the frontend after selecting the new option will order listings by the largest area first