Sydney: Contact Info - Add a link to the phone number

Hello,

I’m using the “Sidney: Contact Info” Widget and want to add a link to the phone number.

Just adding html to the number doesn’t work.

I tried some custom javascript:

;(function($) {
  
  if( $('.contact-address').length ) {

      var address     = $('.contact-address').text();
      var addressArr  = address.split("//");
      var newAddress  = addressArr.join("<br/>");



      // Second phone 

      var phoneNumber = '1234';
      var phoneHTML   = '<a href="/link-url"><div class="contact-phone"><span><i class="fa fa-phone"></i></span>'+phoneNumber+'</div></a>';
      $('.contact-phone').after(phoneHTML);
      
  }

})(jQuery);

But the problem is, it adds a second phone number with the link I want, but it just works if I have a phone number set in the widget, if I delete the number the second number doesn’t show up.

Can you help me?

Hello there,

By default the phone number has a link to trigger a call action. Which version of Sydney Pro are you running? Is it the latest one?

Regards,
Kharis

I’m using Version: 2.0.10. Which is the latest version.

There is no Call to Action as I know.

k1

Sorry I did say I’m using “Sidney FP: Contact” but I usw “Sidney: Contact Info”.

Hello there,

Please try removing your current jQuery code and use this one:

    (function($){

     if( $('.widget_sydney_contact_info .contact-phone').length ) {
       var phone = '+91-75877427';
       var phoneHTML = ' <a href="tel:'+phone+'">'+phone+'</a>';
       $('.widget_sydney_contact_info .contact-phone').html('<span><i class="fa fa-phone"></i></span>' + phoneHTML);
     }

    })(jQuery);

Regards,
Kharis

Thank you,

you’re code did almost worked. I just did a little change to make it work.

(function($){

  if( $('.contact-address').length ) {
   var phone = '+91-75877427';
   var phoneHTML = ' <a href="tel:'+phone+'">'+phone+'</a>';
   $(' .contact-phone').html('<span><i class="fa fa-phone"></i></span>' + phoneHTML);
 }

})(jQuery);

So I needed to remove: .widget_sydney_contact_info

It works now the way I wanted.

Great! You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis