Cara Memasang Tombol like Facebook, Twitter Tweet, Google+ & Share di Blog.

Posted by

tombol share di blog


Ada banyak cara memasang widget share di blog. Untuk tutorial kali ini, saya akan membagikan sebuah trik mudah memasang Tombol like facebook, twitter tweet, google+ & share di blog. Tombol share ini sendiri berfungsi untuk menyebarluaskan artikel kita. Semakin blog kita dipromosi lewat tombol share ini maka semakin popular juga artikel blog kita. Langsung saja ini dia 

- login ke blog anda
- pilih rancangan --> tambah elemen --> pilih HTML/Javascript
- Lalu copy kode berikut ke dalam nya.


<!-- AddThis Button BEGIN -->
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js"></script>

<script type='text/javascript'>

document.doAT = function(cl)

{

        var myclass = new RegExp('hentry');
        var myTitleContainer = new RegExp('post-title');
        var myPostContent = new RegExp('post-footer');
        var elem = this.getElementsByTagName('div');
        for (var i = 0; i < elem.length; i++)
        {
            var classes = elem[i].className;
            if (myclass.test(classes))
            {
                var container = elem[i];
                for (var b = 0; b < container.childNodes.length; b++)
                {
                    var item = container.childNodes[b].className;
                    if (myTitleContainer.test(item))
                    {
                        var link = container.childNodes[b].getElementsByTagName('a');
                        if (typeof(link[0]) != 'undefined')
                        {
                            var url = link[0].href;
                            var title = link[0].innerHTML;
                        }
                        else
                        {
                            var url = document.url;
                            var title =  container.childNodes[b].innerHTML;
                        }
                        if (typeof(url) == 'undefined'|| url == 'undefined' ){
                            url = window.location.href;
                        }
                    var singleq = new RegExp("'", 'g');
                    var doubleq = new RegExp('"', 'g');                                                                                                                                                                                                                         
                    title = title.replace(singleq, '&#39;', 'gi');
                    title = title.replace(doubleq, '&#34;', 'gi');
                  
                    }
                    if (myPostContent.test(item))
                    {
                        var footer = container.childNodes[b];
                    }
                }
                var n = document.createElement('div');
                var at = "<div class='addthis_toolbox addthis_default_style ' addthis:title='"+title+"' addthis:url='"+encodeURI(url)+"'   > <a class='addthis_button_facebook_like' fb:like:layout='button_count'></a> <a class='addthis_button_tweet'></a> <a class='addthis_button_google_plusone' g:plusone:size='medium'></a> <a class='addthis_counter addthis_pill_style'></a> </div> ";
                n.innerHTML = at;
                container.insertBefore(n , footer);
            }
        }
    return true;
};



document.doAT('hentry');

</script>

<!-- AddThis Button END -->



- jangan lupa klik Save.

Hasilnya akan seperti gambar di bawah ini

memasang tombol share di blog


Blog, Updated at: 11:48 PM

8 comments:

  1. 90minup ข่าวกีฬา ฟุตบอล ผลบอล วิเคราะห์บอล พรีเมียร์ลีก ฟุตบอลไทย
    ข่าวกีฬา
    ข่าวฟุตบอล
    ฟุตบอลไทย
    ฟุตบอล
    วิเคราะห์บอล
    ผลบอล

    ReplyDelete
  2. you have a great post and i like it . keep it up


    โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
    เพียงแค่คุณสมัคร Gclub กับทางทีมงานของเราเพียงเท่านั้น
    ร่วมมาเป็นส่วนหนึ่งกับเว็บไซต์คาสิโนออนไลน์ของเราได้เลยค่ะ
    สมัครสมาชิกที่นี่ >>> Gclub online

    ReplyDelete
  3. Much thanks to you so much imparting this useful blog to us. Get Website Dresigning and Development Services by the best Website Designing Company in Delhi, ogen infosystem.
    Top 5 Website Designing Company Delhi

    ReplyDelete
  4. Nice blog, visit for the best Mutual Fund advice about the best mutual fund companies in delhi, India by Mutual Fund Wala.
    Mutual Fund Distributor

    ReplyDelete
  5. Great blog, thank you so much for sharing with us. Get a custom mobile app development services at Appslure WebSolution by the professional ios app designers and developers and also get e-commerce app Services

    ReplyDelete

menyan