PHPackages                             mindkomm/theme-lib-links-phone - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mindkomm/theme-lib-links-phone

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mindkomm/theme-lib-links-phone
==============================

Collection of phone link helper functions for WordPress themes

v2.0.0(1y ago)05151MITPHPPHP &gt;=7.0.0

Since Feb 13Pushed 1y ago3 watchersCompare

[ Source](https://github.com/mindkomm/theme-lib-links-phone)[ Packagist](https://packagist.org/packages/mindkomm/theme-lib-links-phone)[ RSS](/packages/mindkomm-theme-lib-links-phone/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

Phone Links
===========

[](#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 `` entry to your website to disable detection of phone links from third-party scripts.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require mindkomm/theme-lib-links-phone
```

Usage
-----

[](#usage)

When you use [Timber](https://github.com/timber/timber), you can use some of the provided functions in Twig.

**Twig**

```
{{ number }}
```

Functions
---------

[](#functions)

NameSummaryTypeReturns/Description[get\_phone\_link\_attributes](#get_phone_link_attributes)Gets phone number wrapped in proper HTML attributes.`string`HTML attribute string.[phone\_accessible](#phone_accessible)Formats phone number for screenreaders.`string`Formatted telephone number for accessibility.[phone\_raw](#phone_raw)Gets phone number without any formatting.`string`Formatted telephone number.### phone\_accessible

[](#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.

NameTypeDescription$phone\_number`string`Telephone number.**PHP**

```

```

---

### get\_phone\_link\_attributes

[](#get_phone_link_attributes)

Gets phone number wrapped in proper HTML attributes.

`get_phone_link_attributes( string $phone_number )`

**Returns:** `string` HTML attribute string.

NameTypeDescription$phone\_number`string`Telephone number.**PHP**

```
