WhatsApp Sharing Button for Website - WhatsApp sharing button will showing just on mobile device or smartphone. So it won't showed up on computer or laptop. There is two tutorials for adding a WhatsApp's share widget, one for blogger and the other for another CMS like WordPress, Drupal, and many others.
WHATSAPP SHARE BUTTON FOR WEBSITE
<script>LOCATION: Put that script under the Article's Post.
//<![CDATA[
var whatsurl = window.location.href;
var whattitle=encodeURIComponent(document.title);
var whattitle_esc=unescape(whattitle);
document.write('<span style="display:block;font-size: 18px;font-weight: 500;margin-bottom:5px">Share On Whatsapp:</span>\
<a href="whatsapp://send" data-text="'+whattitle_esc+'" data-href="' + whatsurl + '" class="wa_btn wa_btn_l" style="display:none" title="Share On Whatsapp">\
Share</a>\
');
if(typeof wabtn4fg==="undefined"){wabtn4fg=1;h=document.head||document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript";s.src="http://yourjavascript.com/0015517398/whatsapp-button.js";h.appendChild(s);}
//]]>
</script>
WHATSAPP SHARE BUTTON FOR BLOGGER
<b:if cond='data:blog.isMobileRequest == "true" and data:blog.pageType == "item"'>LOCATION: For Blogger's, put that script under the Article's Post.
<script>
//<![CDATA[
var whatsurl = window.location.href;
var whattitle=encodeURIComponent(document.title);
var whattitle_esc=unescape(whattitle);
document.write('<span style="display:block;font-size: 18px;font-weight: 500;margin-bottom:5px">Share On Whatsapp:</span>\
<a href="whatsapp://send" data-text="'+whattitle_esc+'" data-href="' + whatsurl + '" class="wa_btn wa_btn_l" style="display:none" title="Share On Whatsapp">\
Share</a>\
');
if(typeof wabtn4fg==="undefined"){wabtn4fg=1;h=document.head||document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript";s.src="http://yourjavascript.com/0015517398/whatsapp-button.js";h.appendChild(s);}
//]]>
</script>
</b:if>
Example of location for Blogger
Open your Blogger Edit Template. Find the similar code like this:<data:post.body/>
</b:if>
<div class='clear'/> <!-- clear for photos floats -->
</div>
Put the WhatsApp's script after <data:post.body/>. So it would be like this:
<data:post.body/>
<b:if cond='data:blog.isMobileRequest == "true" and data:blog.pageType == "item"'>
<script>
//<![CDATA[
var whatsurl = window.location.href;
var whattitle=encodeURIComponent(document.title);
var whattitle_esc=unescape(whattitle);
document.write('<span style="display:block;font-size: 18px;font-weight: 500;margin-bottom:5px">Share On Whatsapp:</span>\
<a href="whatsapp://send" data-text="'+whattitle_esc+'" data-href="' + whatsurl + '" class="wa_btn wa_btn_l" style="display:none" title="Share On Whatsapp">\
Share</a>\
');
if(typeof wabtn4fg==="undefined"){wabtn4fg=1;h=document.head||document.getElementsByTagName("head")[0],s=document.createElement("script");s.type="text/javascript";s.src="http://yourjavascript.com/0015517398/whatsapp-button.js";h.appendChild(s);}
//]]>
</script>
</b:if>
<div class='clear'/> <!-- clear for photos floats -->
</div>
Finish!
0 comments:
Post a Comment