Pages

Feb 14, 2016

get Social Share

simple method to implement social Share in a page



<?php
$url = “www.test.com”;
?>

<ul class=”social-ul-like”>
<!–<li><iframe src=”//www.facebook.com/plugins/like.php?href=https://www.facebook.com/Expiredbeans&layout=button_count&show_faces=true&width=500&action=like&font&colorscheme=light&height=23″ scrolling=”no” frameborder=”0″ style=”border:none; overflow:hidden; width:110px; height:23px;” allowTransparency=”true”></iframe></li>–>
<li >
<div id=”fb-root”></div>
<div class=”fb-like” data-send=”false” data-layout=”button_count” data-width=”1″ data-show-faces=”false” data-href=”<?php echo CONFIG::SITEURL.’Shared-‘.$donatecode ?>”></div></li>
<li><a href=”https://twitter.com/share” class=”twitter-share-button” data-count=”horizontal” data-url=”<?php echo CONFIG::SITEURL.’Shared-‘.$donatecode ?>”>Tweet</a></li>
<li><div class=”g-plusone” data-size=”medium” data-count=”true” data-href=”<?php echo CONFIG::SITEURL.’Shared-‘.$donatecode ?>”></div></li>
<li><script type=”IN/Share” data-url=”<?php echo CONFIG::SITEURL.’Shared-‘.$donatecode ?>” data-counter=”right”></script></li>
<li>
<a data-pin-zero=”true” href=”//www.pinterest.com/pin/create/button/?url='<?php echo CONFIG::SITEURL.’Shared-‘.$donatecode ?>&media=<?php echo $url ?>'” data-pin-do=”buttonBookmark” data-pin-config=”beside”><img src=”//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png” /></a>
<!– Please call pinit.js only once per page –>
<script type=”text/javascript” async src=”//assets.pinterest.com/js/pinit.js”></script>
</li>
</ul>

<script>
/*
* Async Sharing Buttons (G+, Facebook, Twitter)
* http://www.narga.net/load-social-button-javascript-asynchronously/
* Simple JavaScript function that loads the third-party scripts asynchronously and after the page loads to improve site performance.
*/
(function(doc, script) {
var js, fjs = doc.getElementsByTagName(script)[0],
frag = doc.createDocumentFragment(),
add = function(url, id) {
if (doc.getElementById(id)) {
return;
}
js = doc.createElement(script);
js.src = url;
id && (js.id = id);
frag.appendChild(js);
};
// Google+ button
add(‘http://apis.google.com/js/plusone.js’);
// Facebook SDK200103733347528
add(‘http://connect.facebook.net/en_US/all.js#xfbml=1&appId=419566788248228′, ‘facebook-jssdk’);
// Twitter SDK
add(‘http://platform.twitter.com/widgets.js’);
fjs.parentNode.insertBefore(frag, fjs);
}(document, ‘script’));
$(window).load(function () {
loadSocial();
});
function loadSocial() {
//Linked-in
if (typeof (IN) != ‘undefined’) {
IN.parse();
} else {
$.getScript(“http://platform.linkedin.com/in.js”);
}
}
</script>

No comments: