share wordpress post on whatsapp without plugin

Solutions on MaxInterview for share wordpress post on whatsapp without plugin by the best coders in the world

showing results for - "share wordpress post on whatsapp without plugin"
Alice
12 Jan 2020
1<?php $url = urlencode(get_the_permalink()); $title = htmlspecialchars(urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8'); ?>
2 
3<div class='social-share'>
4<a class='fb' target="_blank" href="http://www.facebook.com/sharer.php?u=<?php echo $url;?>">Facebook</a>
5<a class='tw' target="_blank" href="https://twitter.com/intent/tweet?url=<?php echo $url;?>&text=<?php echo $title; ?>">Twitter</a>
6<a class='pi' href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());">Pinterest</a>
7<a class='go' target="_blank" href="https://plus.google.com/share?url=<?php echo $url;?>">Google+</a>
8<a class='li' target="_blank" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url;?>">Linkedin </a>
9<a class='wh' href="whatsapp://send?text=<?php echo ($title ." ". $url);?>">WhatsApp</a>
10<a class='ma' target="_blank" href="mailto:?subject=<?php echo $title;?>&body=%20<?php echo $url;?>">EMAIL</a>
11</div>
12
Jacob
09 Feb 2017
1add_filter('the_content', 'br_content_with_social_buttons');
2function br_content_with_social_buttons($content){
3    $url = urlencode(get_permalink());
4    // Get current page title
5    $title = str_replace(' ', '%20', get_the_title());
6    $blog_title = get_bloginfo('name');
7    $content .='
8    <div id="social-share">
9        <strong><span>Sharing is caring</span></strong> <i class="fa fa-share-alt"></i>  
10        <a href="https://www.facebook.com/sharer.php?u='.$url.'" target="_blank" class="facebook"><i class="fa fa-facebook"></i> <span>Share</span></a>
11        <a href="https://plus.google.com/share?url='.$url.'" target="_blank" class="gplus"><i class="fa fa-google-plus"></i> <span>+1</span></a>
12        <a href="https://twitter.com/intent/tweet?text='.$title.'&url='.$url.'&via=YOUR_TWITTER_HANDLE_HERE" target="_blank" class="twitter"><i class="fa fa-twitter"></i> <span>Tweet</span></a>
13        <a href="http://www.linkedin.com/shareArticle?mini=true&url='.$title.'" target="_blank" class="linkedin"><i class="fa fa-linkedin"></i> <span>Share</span></a>
14        <a href="whatsapp://send?text='.$title.' '.$url.'" target="_blank" class="whatsapp"><i class="fa fa-whatsapp"></i> <span>Share</span></a>
15    </div>';
16    return $content;
17}
18