-6

adapting a theme for a website , there is a nice top head bar with a phone number on the top right but I d like it to be clickable when people browse it on their mobile, could you help me on this ?

 $phone = isset( $ct_options['ct_contact_phone_header'] ) ? esc_attr( $ct_options['ct_contact_phone_header'] ) : '';    
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

1 Answers1

2

Assuming that array holds just the phone number...

? '<a href="tel:'.esc_attr($ct_options['ct_contact_phone_header'].'">'.esc_attr($ct_options['ct_contact_phone_header'].'</a>'

alternatively you can do it outside of your ternary when you actually echo out the $Phone variable..

echo '<a href="tel:'.$phone.'">'.$phone.'</a>';

Also, why just clickable on mobile? Some people want to click on their computer to call from Skype, or Google.

Ohgodwhy
  • 49,779
  • 11
  • 80
  • 110