The plugin will automatically display telephone numbers in the correct format for international users from any country in the world. It does this by looking up their IP address (using
ipinfo.io) and determining the country, then passing this information along with the phone number to the Telecoms Cloud API which formats the number correctly and adds the appropriate International Direct Dialing Number (IDD).
As of version 2.0.0, the plugin also caches each new request (eg. number X in country Y being dialled from location Z) in order to return results from the cache in the case of subsequent identical requests. This results in less unnecessary requests being made to the Telecoms Cloud API, saving costs and increasing speed.
Example: You may have a London phone number - 02079460981 - which would be displayed like so for visitors from the following countries:
- UK: 020 7946 0981 (no prefix added - just spaces added to make number readable)
- US: 011 44 20 7946 0981
- Spain: 00 44 20 7946 0981
Usage: wherever you want a telephone number to be formatted automatically within your website, use the shortcode like so:
[intPnd servicenumber="02079460981" location="GB"]
Note: you must pass the 2-digit country code in which the telephone number is located. For a list, see
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
This section describes how to install the plugin and get it working.
- Upload
intl-phone-number.php
to the /wp-content/plugins/
directory (or install via WordPress Plugins menu)
- Activate the plugin through the 'Plugins' menu in WordPress
- Sign up for a free Telecoms Cloud API account at https://my.telecomscloud.com/sign-up.html?api and input your API credentials in the plugin's Settings page
- Ensure you have cURL installed for PHP, which is required for the plugin to work. The Settings page will tell you if you need to install this, and how to do it.
- Trigger the plugin to format numbers like this: [intPnd servicenumber="02079460981" location="GB"]