Adding Options to GeoDirectory Custom Fields
GeoDirectory custom fields can be added to any CPT form, to display any type of content. For instance, you can add custom fields to display listing address, phone, email, and so on.
You can also add custom options to certain custom fields, namely, radio, select and multi-select fields. This guide will explain how to add options to custom fields.
Adding Options to Custom Fields
- 1
- Navigate to CPT > Settings > Custom Fields.
- 2
- Next, you need to add the fields to the form, simply by clicking on the field name. Again, options can be added to Radio, Select and Multi-Select fields.
- 3
- You can then specify your options in the Option Values section of the custom field.
- 4
- Be sure to Save your settings.
Additional Info
Adding options to your custom fields is a good way to help users sort content. Here are some points to bear in mind:
- The option values that you specify should be comma-separated. For instance, if you have added a Select field titled "Property Condition", you can add options as "New,Renovated,Needs Repair,Dilapidated". Each of these four options will be selectable to users. Alternatively, you can add these options to Multi-Select field, wherein users can select multiple options.
- If you need to add filterable options, you need to place a / (forward slash) followed by a 0 (zero) or 1 (one) to specify false and true, respectively. For example, "Non-Smoking/0,Smoking/1". This can help users easily shortlist listings of their choice. Note that Tick-to-Filter values work only with Select field, not with Multi-Select.
- You can also work with placeholder options, for instance, for Select field, you can use Status/,Unfurnished,Furnished,Partially furnished,Optional. In this case, if you do not use the , (comma) before the first option, it will be excluded from the list.
If using OPTGROUP tag to grouping options, use "{optgroup}OPTGROUP-LABEL|OPTION-1,OPTION-2{/optgroup}".
Output
Adding options to Select field titled "Status":
Output on the frontend:
Adding options to Radio field titled "Status":
Output on the frontend:
Adding options to Multi-Select field titled "Status":
Output on the frontend:
How to Add Conditional Fields?
Conditional Fields can be added by heading to CPT > Settings > Custom Fields > Edit Fields.
The Conditional Fields option therein allows you to specify conditions for that particular field to show/hide on the frontend. Based on conditions that you specify, the fields will show/hide on the Add Listing page.
Show a field when a specific category is selected
If you want to use conditional fields with categories, use the category ID and the option "contains". This is a great way to keep your add listing form tidy if you have added fields that are specific to listings grouped by category.
Multiselect Field type option groups
When adding a Multiselect you can include a 'group' label that cannot be selected but that groups the options together in a list inside the field view on the form.
Here is an example adding a group for Electronics, such that TV and Laptop will be shown as the actual options, and Electronics is only a label and cannot be selected.
For Sale under-offer : Under Offer optgroup : Electronics TV Laptop optgroup-close
This will look like this in the field options if you copy the spacing and formatting exactly as above.