Page 1 of 1

E-mail and Telephone buttons in projects.

Posted: Tue Jun 15, 2021 1:13 pm
by Hopki
Hi,
When using Go To URL calls such as mailto: then e-mail address in a button then this work ok but in WordPress due to paths and calls breaks.
This is also true of the tel: call to get the computer or phone to make a call.

The solution is to use javascript,
for the call button you would use a Mouse Click, Go To URL action with the URL being:

Code: Select all

javascript: document.location.href = "tel:+xxxxxxxxxxxx";
Set the target to _self
Of course, replace the xxx with the required telephone number.

For the e-mail, again Mouse Click, Go To URL, but this time it's:

Code: Select all

javascript: document.location.href = "mailto:xxxxxx@xxxxxx.com";
Set the target to _self

If you wanted the Subject and Body Text added to the e-mail you would use:

Code: Select all

javascript: document.location.href = "mailto:xxxxxxx@xxxxx.com?subject=Big%20News&body=Thnak you for your interest";
Of course, you can add whatever subject and body text you want.

This also works outside of WordPress so can be used in all projects.