Step 1 - Add this code on your before </body> tag
<script>
function decorateWhatsAppLink() {
var url = "whatsapp://send?text=";
var text = encodeURIComponent(window.location.href);
var $whatsApp = $(".whatsapp");
$whatsApp.attr("href", url + text);
}
decorateWhatsAppLink();
</script>
function decorateWhatsAppLink() {
var url = "whatsapp://send?text=";
var text = encodeURIComponent(window.location.href);
var $whatsApp = $(".whatsapp");
$whatsApp.attr("href", url + text);
}
decorateWhatsAppLink();
</script>
1
2
3
4
5
6
7
8
9
10
11
!2
13
14
2
3
4
5
6
7
8
9
10
11
!2
13
14
<script>
//Whatsapp Sharing Code
function decorateWhatsAppLink() {
var url = "whatsapp://send?text=";
var text = encodeURIComponent(window.location.href)
// Captures the current page URL
var $whatsApp = $(".whatsapp");
$whatsApp.attr("href", url + text);
}
decorateWhatsAppLink();
</script>
//Whatsapp Sharing Code
function decorateWhatsAppLink() {
var url = "whatsapp://send?text=";
var text = encodeURIComponent(window.location.href)
// Captures the current page URL
var $whatsApp = $(".whatsapp");
$whatsApp.attr("href", url + text);
}
decorateWhatsAppLink();
</script>
Copy to Clipboard
Step 2 - Add .whatsapp class to your target button
whatsapp