-->

Cara Membuat Script Widget Recent Comment/Komentar keren

Mungkin segaian templat blog gak suppot dengan Widget Recent Comment yang susah di sediakan pihak Blogger, Keuntungan memasang Widget Recent Comment adalah supaya kita (Administrator) lebih mudah mengetahui postingan mana saja yang di komentari pengunjung, sehingga memudahkan kita untuk membalas komentar para pengunjung blog.
nah kali ini saya akan share artikel Cara Membuat Script Widget Recent Comment/Komentar Terbaru.
Simak baik baik yah.

  • Masuk ke layout/tata letak (saya yakin teman-teman sudah tau)
  • klik tambahkan widget baru lalu pilih widget HTML/JAVASCRIPT
  • Copy script di bawah ini dan pastekan di widget tadi
  • jangan lupa kasih judul
  • SAVE
<div class='widget-content'>
<div style="overflow:auto; padding:5px; width:325px; height:300px; background-color: #ffffff; border:1px solid #ffffff;"><ul>
<script>
function showrecentcomments(json) {
for (var i = 0; i < numcomments; i++) {
var entry = json.feed.entry[i];
var alturl;

if (i == json.feed.entry.length) break;
for (var k = 0; k < entry.link.length; k++) {
if (entry.link[k].rel == 'alternate') {
alturl = entry.link[k].href;
break;
}
}//edit by http://erdie-blog.blogspot.com
alturl = alturl.replace("#", "#comment-");
var postlink = alturl.split("#");
postlink = postlink[0];
var linktext = postlink.split("/");
linktext = linktext[5];
linktext = linktext.split(".html");
linktext = linktext[0];
var posttitle = linktext.replace(/-/g," ");
posttitle = posttitle.link(postlink);
var commentdate = entry.published.$t;
var cdyear = commentdate.substring(0,4);
var cdmonth = commentdate.substring(5,7);
var cdday = commentdate.substring(8,10);
var monthnames = new Array();
monthnames[1] = "Jan";
monthnames[2] = "Feb";
monthnames[3] = "Mar";
monthnames[4] = "Apr";
monthnames[5] = "May";
monthnames[6] = "Jun";
monthnames[7] = "Jul";
monthnames[8] = "Aug";
monthnames[9] = "Sep";
monthnames[10] = "Oct";
monthnames[11] = "Nov";
monthnames[12] = "Dec";
if ("content" in entry) {
var comment = entry.content.$t;}
else
if ("summary" in entry) {
var comment = entry.summary.$t;}
else var comment = "";
var re = /<s[^>]*>/g;
comment = comment.replace(re, "");
if (!standardstyling) document.write('<div class="bbrecpost">');
if (standardstyling) document.write('<li>');
document.write('<a href="' + alturl + '">' + entry.author[0].name.$t + '</a>');
if (showposttitle == true) document.write(' on ' + posttitle);
if (showcommentdate == true) document.write(' at ' + monthnames[parseInt(cdmonth,10)] + ' ' + cdday + ' ');
if (!standardstyling) document.write('</div><div class="bbrecpostsum">');
if (standardstyling) document.write('<br/>');
if (comment.length < numchars) {
if (standardstyling) document.write('<i>');
document.write(comment);
if (standardstyling) document.write('</i>');}
else
{
if (standardstyling) document.write('<i>');
comment = comment.substring(0, numchars);
var quoteEnd = comment.lastIndexOf(" ");
comment = comment.substring(0, quoteEnd);
document.write(comment + '...<a href="' + alturl + '">(more)</a>');
if (standardstyling) document.write('</i>');}
if (!standardstyling) document.write('</div>');
}//edit by http://www.masbugie.com
if (!standardstyling) document.write('<div class="bbwidgetfooter">');
if (standardstyling) document.write('</li>');
if (!standardstyling) document.write('</div>');}
</script>
<script style="text/javascript">
var numcomments = 10;
var showcommentdate = false;
var showposttitle = true;
var numchars = 100;
var standardstyling = true;
</script>
<script src="URL BLOG ANDA/feeds/comments/default?alt=json-in-script&callback=showrecentcomments"></script>
</ul></div>
</div>
<div class='clear'>
</div>
Catatan:

  • 500px = Lebar widget
  • 300px = Tinggi Widget
  • #ffffff = Warna Background Widget
  • paling bawah isi dengan URL Blog anda,
  • Ubah tulisan yang berwarna merah saja.
Mudah kan?
Selamat mencoba.
Terimakasih telah membaca artikel Cara Membuat Script Widget Recent Comment/Komentar Terbaru dan Terimakasih telah berkunjung.
Semoga bermanfaat.