Support

Account

Home Forums Backend Issues (wp-admin) Phone field with href="tel:" link Reply To: Phone field with href="tel:" link

  • Hi everyone, thanks for the tip but I found that if you just use the bottom portion of the script it works just as well. In elementor I gave all of my ACF phone buttons a css class of phoneButton (I have multiple acf phone buttons so an ID wouldn’t work for me) and then in Elementor Custom Code I added the script below and applied it to the whole site and it worked (you can also add it to your footer.php). What is the reason for the add_filter? that did nothing for me and I removed it from my functions.php page and my ACF phone buttons still work.

    <script>
    (function($){
    $(“.phoneButton a”).attr(“href”, function ( index, currentvalue) {
    var url_format = currentvalue.replace(/(^\w+:|^)\/\//, “”);
    $(this).attr(“href”, “tel:” + url_format);
    });

    })(jQuery);
    <script>