Data Sources – Predefined Options
If you do not know what are data sources in the WPAdverts Custom Fields extension please refer to the Getting Started with Data Sources article that will explain what are data sources and why you should use them.
Using Predefined Options is the easiest way to get started with Data Sources.
To create a new data source with predefined options go to wp-admin / Classifieds / Options / Custom Fields / Data Sources / Add New Data Source, enter the Title, Name, and in Type field select “Predefined Options.
For each option, you need to fill the following fields:
- value – (shown only if the “use values” checkbox is checked), this is the data that will be saved in the database (and displayed in the Ad details page) or submitted when searching. You should use values only if you want the values saved/displayed to be different from the options the user can see in the form.
- text – this is an option the user will see when filling the form, it will be also saved in the database or displayed in the frontend if the value is not provided.
- depth – this will indent the option in the form, giving an illusion that the options have a hierarchy. The higher the value in this field the more indented the option will be.
- disabled – check this option if you want it to be visible in the form but do not want users to be able to select it.
- drag-icon – you can use it to drag the option up or down, it’s useful when you want to reorder the items on the list.
- trash-icon – clicking on it will remove the option.
The explanation here might be a bit vague, but using the editor is quite simple, i think that you will be able to grasp quickly what each option does by looking at the picture below it shows the configuration and the result on site
Add as many options as you need and then click the “Create Data Source” button.
Assigning Data Source to a field
Once your data source is ready, you need to assign it to a form.
Go to wp-admin / Classifieds / Options / Custom Fields / Form Schemes panel, create a new form or edit existing one.
Edit one of the fields that can use Data Source (that is Checkbox, Radio and Select) in “Fill Method” select “Use registered data source“, a new field named “Data Source” will load, select in it the data source you created and save the field.