I am working on a webpage that lists all the access numbers our customers ask for.

What I am trying to do is turn all the text phone numbers into telephone links through a php function rather than manually add the html markup to every number.

I was hoping that I can do it myself but, damn, what a disappointment!

This is the current markup for each phone number:

<div name="Missouri" style="display:none" class="zebra1"> (573) 213 2134</div>

What I am trying to do is turn the above markup like so:

<div name="Missouri" style="display:none" class="zebra1"> <a href="tel:(573) 213 2134">(573) 213 2134</a></div>

I have only got started and I’m stuck:

function accessnumber($content) {

add_filter('the_content', 'accessnumber',60);

There are over 200 numbers so doing it manually is currently not an option for me.

Any help is appreciated!

Read more here: How to turn each phone number within the $content to a telephone link?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: