E-mail and Telephone buttons in projects.
Posted: Tue Jun 15, 2021 1:13 pm
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:
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:
Set the target to _self
If you wanted the Subject and Body Text added to the e-mail you would use:
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.
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";
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";
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";
This also works outside of WordPress so can be used in all projects.