Created
April 8, 2015 16:17
-
-
Save 9ete/13a4e944581ddd2b1603 to your computer and use it in GitHub Desktop.
Phone Number Shortcode
This file contains hidden or 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
| // Add [phonenumber] shortcode | |
| function phonenumber_shortcode( $atts ){ | |
| //retrieve phone number from database | |
| $lm_array = get_option('lowermedia_phone_number'); | |
| //check if user is on mobile if so make the number a link | |
| if (wp_is_mobile()) | |
| { | |
| return '<a href="tel:+'.$lm_array["id_number"].'">'.format_phonenumber($lm_array["id_number"]).'</a>'; | |
| } else { | |
| return format_phonenumber($lm_array["id_number"]); | |
| } | |
| } | |
| add_shortcode( 'phonenumber', 'phonenumber_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment