This add-on provides an enhanced telephone field specifically designed for international phone numbers. It allows users to input and validate phone numbers in the correct format for their country or region, improving the user experience and data accuracy in your WordPress forms.
Table of contents:
Installation
Once you’ve downloaded a plugin, you’ll need to install it on your website. Log into your WordPress admin dashboard. Navigate to the “Plugins” section and click on “Add New.” Search for the plugin by name and click “Install Now” once you find it.
After installation, click on “Activate” to activate the plugin.
Create an International Telephone Input Field Action – top
Any options that take country codes should be ISO 3166-1 alpha-2 codes : link: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
Step 1: Create a new contact form
Step 2: Click on the form- tag “Telephone” to add an international phone field
Step 3: Save and Have a preview
Setting International Phone Mask Field – top
any options that take country codes should be ISO 3166-1 alpha-2 codes : link: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
How to set a preferred countries list?
Specify the countries to appear at the top of the list.
- Step 1: Click on the form- tag “Telephone“.
- Step 2: You just need to put the countries code into the Preferred Countries box. (Note that, disable search mode)
E.g: We take The United States, Switzerland, and Indonesia at the top list.
<label> Phone Number
[tel tel-592 pre:us|ch|id auto validation]</label>
[submit "Submit"]
- Step 3: Save and Have a preview
You can see three countries are on the top list
How to set the only countries list?
In the dropdown, display only the countries you specify.
You just need to put the countries code into the Only Countries box.
E.g: I want to display only three countries The USA, Myanmar, and Argentina on the list.
<label> Phone Number
[tel tel-73 onlyct:us|mm|ar search auto validation]</label>
[submit "Submit"]
Save and Have a look: there are only these three countries on the list
How to set the exclude countries list?
It’s similar to settings Only countries list. You just put the countries code you don’t want to display on the list.
E.g: We left Myanmar out of the list.
Let’s see: we can’t see Myanmar on the dropdown.
How to automatically select a country based on IP?
You click on the Automatically Select Countries box.
If you are living in The United States, it will automatically set the phone field like this:
How to set the default country?
It means the default country will be preselected. Users can still change the country if needed.
You need to disable automatically select country.
E.g: We set Myanmar as default country:
When users visit your contact form, the phone number field will have the international phone mask applied, and the default country will be preselected
That’s it! We hope this article helped you find out how to add the international phone to your Contact Form 7.