Download the PHP package mindkomm/theme-lib-links-phone without Composer
On this page you can find all versions of the php package mindkomm/theme-lib-links-phone. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mindkomm/theme-lib-links-phone
More information about mindkomm/theme-lib-links-phone
Files in mindkomm/theme-lib-links-phone
Package theme-lib-links-phone
Short Description Collection of phone link helper functions for WordPress themes
License MIT
Informations about the package theme-lib-links-phone
Phone Links
Collection of phone link helper functions for WordPress themes.
- Provides you with a set of functions to handle phone links.
- Automatically adds a
<meta name="format-detection" content="telephone=no">
entry to your website to disable detection of phone links from third-party scripts.
Installation
You can install the package via Composer:
Usage
When you use Timber, you can use some of the provided functions in Twig.
Twig
Functions
Name | Summary | Type | Returns/Description |
---|---|---|---|
get_phone_link_attributes | Gets phone number wrapped in proper HTML attributes. | string |
HTML attribute string. |
phone_accessible | Formats phone number for screenreaders. | string |
Formatted telephone number for accessibility. |
phone_raw | Gets phone number without any formatting. | string |
Formatted telephone number. |
phone_accessible
Formats phone number for screenreaders.
Will convert 052 203 45 00
to 0 5 2. 2 0 3. 4 5. 0 0
. This makes a phone number easier to listen to. Adds
spaces and periods to the phone number. The spaces tell the screen reader to read each digit individually. The
periods tell the screen reader to pause (like at the end of a sentence).
Add the resulting string as an aria-label to your phone number link.
phone_accessible( string $phone_number )
Returns: string
Formatted telephone number for accessibility.
Name | Type | Description |
---|---|---|
$phone_number | string |
Telephone number. |
PHP
Twig
phone_raw
Gets phone number without any formatting.
Example: From '+41 052 203 45 00' to '00410524500'
phone_raw( string $phone_number )
Returns: string
Formatted telephone number.
Name | Type | Description |
---|---|---|
$phone_number | string |
Telephone number. |
PHP
get_phone_link_attributes
Gets phone number wrapped in proper HTML attributes.
get_phone_link_attributes( string $phone_number )
Returns: string
HTML attribute string.
Name | Type | Description |
---|---|---|
$phone_number | string |
Telephone number. |
PHP
will result in
HTML
Twig
Twig functions
You need Timber to use these functions.
- get_phone_link_attributes
- phone_accessible
Support
This is a library that we use at MIND to develop WordPress themes. You’re free to use it, but currently, we don’t provide any support.