https://github.com/tomdevisser29/toms-acf-fields
A WordPress plugin that adds extra ACF field types, including improved URL and phone fields, extending the capabilities of the base plugin.
https://github.com/tomdevisser29/toms-acf-fields
acf plugin wordpress
Last synced: about 1 year ago
JSON representation
A WordPress plugin that adds extra ACF field types, including improved URL and phone fields, extending the capabilities of the base plugin.
- Host: GitHub
- URL: https://github.com/tomdevisser29/toms-acf-fields
- Owner: tomdevisser29
- Created: 2024-10-12T15:45:54.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-23T16:33:17.000Z (over 1 year ago)
- Last Synced: 2025-03-31T00:05:06.394Z (about 1 year ago)
- Topics: acf, plugin, wordpress
- Language: PHP
- Homepage:
- Size: 75.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tom's ACF Fields
This plug-in adds some extra ACF Field Types that are not available in the base plug-in.

## Website URL
This field will automatically strip the web protocol entered (e.g. "http") and set it to "https" when you save the post, so it's always using a secure protocol.
It's also styled in a way that shows the "https://" prepend before the input.

## Phone Number
This field will automatically strip the entered phone number down to only digits. It will then create formatted phone numbers for display, links (compatible with `tel:`), and save the country code, country prefix and originally entered value.

```
array(6) {
["country"]=>
string(2) "nl"
["number"]=>
string(9) "612345678"
["display"]=>
string(15) "+31 6 1234 5678"
["stripped"]=>
string(9) "612345678"
["prefix"]=>
string(3) "+31"
["tel"]=>
string(12) "+31612345678"
}
```
### Adding countries
To add more countries, you can extend this field type in 4 steps.
1. Add the option to `render_field()`
2. Add the display formatting to `format_phone_number_for_display()`
3. Add the validation to `validate_value()`
4. Add the correct prefix to `get_country_prefix()`