Home > How to... > Script Library > Add social Share button to the blog

Add social Share button to the blog

<script> // Add social Share button to the blog
$( function() {
    $('.Mainposttitle a').parent().append('<div id="blog_social_container"></div><br>');
    $('div#blog_social_container').append('<div class="g-plus" data-action="share" data-annotation="bubble"></div>').append('<div style="width:100px;"><a href="https://twitter.com/share" class="twitter-share-button" data-lang="en">Tweet</a></div>').append('<div class="fb-like" data-send="true" data-layout="button_count" data-width="210" data-show-faces="false"></div>');
    $('div#blog_social_container div').each(function() {$(this).css('float','left')});
});
// add Google+ like
(function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = 'https://apis.google.com/js/plusone.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);})();
// add twitter button
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
// add facebook share and like
(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));
</script>


Translate and Localize your website with 'Localizer pluggin

Shopping Cart Software by Ashop