-
-
Save billerickson/19bfa55b83c3a7e885819ff73bc8c290 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Phone URL | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/phone-number-url | |
* | |
* @param string $phone_number, ex: (555) 123-4568 | |
* @return string $phone_url, ex: tel:5551234568 | |
*/ | |
function ea_phone_url( $phone_number = false ) { | |
$phone_number = str_replace( array( '(', ')', '-', '.', '|', ' ' ), '', $phone_number ); | |
return esc_url( 'tel:' . $phone_number ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment