I would like my listings phone numbers to appear in a standard format.
(country code)-(area code)-(first 3)-(last four)
ie. 1-800-555-5555
I feel like the input field should just require the standard format. This would solve the problem at its beginning, the user input.
I understand every country has a different format, and every geodirectory user could have a different preference. This is more of a custom preference, not some development issue.
I found two pages on this topic, but no solution is mentioned besides needing “customization”.
The below post mentions the issue of the input field accepting characters that are not numbers, but no solution.
https://wpgeodirectory.com/support/topic/phone-number-2/
This post has a solution that only allows input of ‘numbers’.
https://wpgeodirectory.com/support/topic/formatting-phone-numbers/
Some companies may have vanity phone numbers. One of my companies does, as well. So restricting the input to numbers is not a concern for us. We just want to add the dashes (-) where necessary and enforce the country code. Our site is primarily USA for now, but hope to expand globally.
I think a page specific code snippet would be best, targeting the phone input field on the add listing page.
If not that then maybe a front-end code snippet targeting the phone field would fix this, however not every user will use a country code, and some may post with parenthesis creating other issues, and making the amount of code needed larger.