P
P
Parrot2232021-07-21 16:36:20
PHP
Parrot223, 2021-07-21 16:36:20

How to reformat a number?

<a class="footer-phone" href="tel:+68323247983"><?= CFS()->get('phone', 19) ?></a>


There is a custom field in WP where the admin enters a number in the format +6 (832) 324-79-83 and in the same format it is displayed in place of CFS()->get('phone', 19). But in the href attribute, after tel: the format is +68323247983. It is clear that in JS by .replace all unnecessary characters will be removed, but how to accept the value of CFS()->get('phone', 19) from php, pass it to JS and remake + how to make it so that after tel: the "altered" value was inserted automatically, i.e. JS answer?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question