- Introduction
- Installation
- Configuration
- Usage
- F.A.Q.
- Actions
- Filters
- Functions
- Countries
- Uninstall
- Contributors
- Support
Introduction
This plugin extends the functionality of ACF. Just install it and discover a new field choice. See it in action here.
Installation
- Download the plugin here.
- Upload it through FTP to wp-content/plugins or use the upload function and upload the downloaded zip file.
- Activate the plugin through the plugins page.
Configuration
- Open or create an ACF field group.
- Click 'Add Field'.
- Add a field name/label.
- Add the 'City Selector' field option (see example below).
- Select whether to show labels above the input fields (default = yes).
- Select whether to use a default country (default = false).
- Select which fields to use (default = all).
- Save/publish the Field Group.
Usage
To retrieve a stored value use the following code:
$city_selector = get_field('field_name');
The variable $city_selector returns 5 values in an array:
array(5) {
["countryCode"]=>
string(2) "NL"
["stateCode"]=>
string(5) "NH"
["cityName"]=>
string(9) "Amsterdam"
["stateName"]=>
string(13) "Noord-Holland"
["countryName"]=>
string(11) "Netherlands"
}
Output it as follows:
$city_selector = get_field('field_name');
echo 'I live in ' . $city_selector['cityName'];
echo 'which is in ' . city_selector['stateName'] . ' (' . city_selector['stateCode'] . ')';
echo ' which lies in the country ' . $city_selector['country'] . ' (' . $city_selector['countryCode'] . ')';
This outputs:
"I live in Amsterdam which is in Noord-Holland (NH) which lies in the country Netherlands (NL)"
Countries
If you install the plugin you get 2 countries included;
- Belgium
- Netherlands
You can delete them from the settings page (if you want). And re-import them separately (if you would only need 1 or 2).
Get more countries
If you would like to get more countries for your form, you can create a CSV formatted file/data set and import them manually. Please find more info about this in the contextual help menus. You can find an excel file in there as well to help you out.
We also have some 'pre-made country packages', which are ready to be imported. Click here to see which countries are available.
Uninstall
If you uninstall the plugin it is thoroughly cleaned. This means all settings are removed as well as the folder which might contain your CSV files.
Contributors
Berry Plasman (Plugin author)
Jarah de Jong (Javascript)
John McDonald (German translations)
Support
If you need support, please turn to GitHub (for now).