Jump to content

clickable phone number


gmazanakis
 Share

Recommended Posts

Turn them into links. Make sure to have no spaces in the phone number (inside href)

<a href="tel:05345345345">Call Us!</a>

To remove the spaces from  a given phone number you can use:

$spaced = ' 345 345    234   ';
$clean = preg_replace('!\s+!', '', $spaced);
$telUrl = "tel:$clean";

 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

3 hours ago, gmazanakis said:

in which file i have to add the line's above?

Quick answer will be in a template file. I am assuming your next question will be, what is a template file?  If I am not wrong, I would encourage you to first read up on ProcessWire, at least get to know the basics

As for a windows server, I have zero experience but IIRC, some people have had success running ProcessWire on such.

Welcome to the forums.

 

  • Like 1
Link to comment
Share on other sites

47 minutes ago, kongondo said:

To the best of my knowledge, there is no module that will make phone numbers on your site clickable. We have a Phone Fieldtype, but I don't think that's what you want.

As @kongondo said that module, while being very useful if you want as easier way to manage entry and formatting of phone numbers and their component parts, it won't do what you want.

Actually I am starting to think that what you are looking for is a way to format/convert phone numbers that are entered into a textarea/body field into clickable links, rather than having a dedicated phone number field. Is that correct? If so, then that could actually make a useful Textformatter module.

 

Link to comment
Share on other sites

this is the part of the code that we have set the phones number in the _init.php template

$static_translations['telephone']['default'] = "Τηλ:<br>2821011111";
$static_translations['telephone']['english'] = "Phone:<br>00302821011111";

is it here that i have to put the code above ?

 

Link to comment
Share on other sites

The main point here is that each ProcessWire site is unique. There's no 100% sure answer we can tell you without digging deeper into your codebase.

That being said, you could try changing the lines you've posted here to something like this:

$static_translations['telephone']['default'] = "Τηλ:<br><a href='tel:2821011111'>2821011111</a>";
$static_translations['telephone']['english'] = "Phone:<br><a href='tel:+302821011111'>00302821011111</a>";

Please be aware that this might not work as expected, and it might look awful if your site's stylesheet don't expect these numbers to be links. You should also test both versions afterwards to make sure that they actually work as expected – i.e. result in a call.

Edited by teppo
Fixed quotes :)
  • Like 1
Link to comment
Share on other sites

Thanks a lot for the reply. Unfortunately it does not work. There is some error to the code above and if I use it the site does not work appears “

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Error has been logged.

Link to comment
Share on other sites

$static_translations['telephone']['default'] = "Τηλ:<br><a href=\"tel:2821011111\">2821011111</a>";
$static_translations['telephone']['english'] = "Phone:<br><a href=\"tel:+302821011111\">00302821011111</a>";

OR

$static_translations['telephone']['default'] = "Τηλ:<br><a href='tel:2821011111'>2821011111</a>";
$static_translations['telephone']['english'] = "Phone:<br><a href='tel:+302821011111'>00302821011111</a>";

 

  • Like 1
Link to comment
Share on other sites

Thank you so so much. 

that’s work but I have two issues the first one I think is important 

a) after I make the change when I go to the site using a public WiFi appears (before the changes does not appears this messages): 

Web Page Blocked!

You have tried to access a web page which is in violation of your internet usage policy.

URL: http://www.mazanakishomes.gr/
Category: Newly Observed Domain 
Client IP: 192.168.120.4 
Server IP: 185.4.133.172 
User name: 
Group name: ....

and at google chrome say the massage  that the connection it is not private.... like my site it is not secure

 

b) (minor importance) except from the main contact page I change also and the phone at the head.inc but from gry color the numbers become blue. Is it easy to keep the color gry

Link to comment
Share on other sites

Hi,

In site/external/style/style.css, just add:

.template-phone a {
    color: #999;
}

between

.contact-details li::before
{
    ...
}

and

/* --- social icons --- */

(currently line 2209).

Edit: do you want to keep the color that is currently orange for the phone number on the contact page?

Edited by Christophe
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...