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>
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.