Add Whatsapp social sharing link

Status
Not open for further replies.

alnadabi

Founder license
License owner
Hello,

everyone knows that Whatsapp become the most famous social networking app in the world . and its good opportunity to market your service in Whatsapp as it will boost your visitors counts.

I managed successfully to add whatsapp sharing link by adding the following code in share_links.php under the $share_links_networks array :

Code:
    'whatsapp'    => array(
        'url'    => 'whatsapp://send?text=%0A %TITLE %0A %URL% %0A A free Image sharing by www.yourwebpage.com',
        'label' => 'Whatsapp'
    ),
NOTE : %0A = is treated as break line in whatsapp.


its working great with the users who are using smartphone .. and when they click on the link it will insert the link directly in Whatsapp App .


Another file to alter :
- CSS : peafowl.min.css [Added the following]

Code:
.btn-whatsapp,.link-whatsapp span{background:#1eb211;}.btn-whatsapp:hover,.link-whatsapp:hover span{background:#127d08;}
.icon-whatsapp:before{content:"\e694";}


Couple of issues I found :
1. I could not see Whatsapp icon in Icomoon fonts, so I used a close 'similar' icon to whats app. which have the chat shape and i set it with green background.

2. I don't get a solution to hide this link if the users coming from tablets/desktop/laptop devices, but I think its quite easy if we can have function to check this part.


I hope we can see this option in the next releases of Cheverto .


Thank you,
AlNadabi
 

malvernweb

Network license
License owner
2. I don't get a solution to hide this link if the users coming from tablets/desktop/laptop devices, but I think its quite easy if we can have function to check this part.

Add this to your share_links.php instead, at the bottom, underneath everything else ....

Code:
function isMobile() {
  return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|up\.browser|up\.link|webos|wos)/i",
$_SERVER["HTTP_USER_AGENT"]);
}
if(isMobile()){
 $share_links_networks['whatsapp'] = array(
  'url'  => 'whatsapp://send?text=%0A %TITLE% %0A %URL% %0A A free Image sharing by www.yourwebpage.com',
  'label' => 'Whatsapp'
);
}

It should detect if the user is using a mobile browser. Only then will it append the share links array with the Whatsapp icon :)
 
Last edited:

alnadabi

Founder license
License owner
Add this to your share_links.php instead, at the bottom, underneath everything else ....

Code:
function isMobile() {
  return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|up\.browser|up\.link|webos|wos)/i",
$_SERVER["HTTP_USER_AGENT"]);
}
if(isMobile()){
$share_links_networks['whatsapp'] = array(
  'url'  => 'whatsapp://send?text=%0A %TITLE% %0A %URL% %0A A free Image sharing by www.yourwebpage.com',
  'label' => 'Whatsapp'
);
}

It should detect if the user is using a mobile browser. Only then will it append the share links array with the Whatsapp icon :)
Thank you
 
Status
Not open for further replies.
Top