kisabelle
2/18/2014 - 7:49 PM

Social sharing links

Social sharing links

// HTML entity decoding for safe input
$text = html_entity_decode($text, ENT_COMPAT, 'UTF-8');


// Twitter
<a target="_blank" class="button" href="http://twitter.com/share?text=<?php echo $text; ?>&url=<?php echo $url ?>">Tweet It</a>

// Facebook
<a target="_blank" class="button" href="http://www.facebook.com/sharer.php?u=<?php echo $url ?>">Like It</a>

<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fparse.com" target="_blank">
 Share on Facebook
</a>

// Pinterest
<a class="button" href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());">Pin It</a>

// Email
<a class="button" href="mailto:?subject=I wanted you to see this!&body=<?php echo $text . ' - ' . $url; ?>">Mail It</a>