Menulis

Menampilkan Daftar Posting Blog Paling Banyak Dikomentari

Posted by Romel Tea ● Follow @romeltea ● Like Romeltea Media on Facebook

Most Commented Posts
Cara memasang, menampilkan, atau membuat widget berisi daftar posting blog yang paling banyak dikomentari (Most Commented Posts Widget) di sidebar atau footer widget blog sangat mudah.

Demonya ada di Footer blog ini. Saya kasih judul widgetnya "Most Commented" (Paling Banyak Dikomentari).

Widget Most Commented Posts ini mirip dengan Popular Posts. Bedanya, Popular Pots mah berdasarkan jumlah kunjungan. Most Commented Posts berdasarkan jumlah komentar.

Widget yang dipasang di sidebar atau footer blog ini bisa juga disebut atau dinamai widget "Hot Topics", "Paling Banyak Komentar", atat "Trending".

Cara Membuat Widget Most Commented Posts

1. Layout >> Sidebar >> Add a gadget >> Add HTML/JavaScript
2. Judul kasih nama Most Commented Post, Paling Banyak Dikomentari, dll. Bebas!
3. Copas saja kode berikut ini ke kolom "Content"

<script type="text/javascript">
function getYpipePP(feed) {
 document.write('<ol style="">');
 var i;
 for (i = 0; i < feed.count ; i++)
 {
var href = "'" + feed.value.items[i].link + "'";
var pTitle = feed.value.items[i].title;
var pComment = " \(" + feed.value.items[i].commentcount + "\)";
var pList = "<li>" + "<a href="+ href + '" target="_blank">' + pTitle;
 document.write(pList);
 document.write(pComment); //to remove comment count delete this line
 document.write('</a></li>');
 }
 document.write('</ol>');
 }
 </script>
 <script src="http://pipes.yahoo.com/pipes/pipe.run?
 YourBlogUrl=http://www.romelteamedia.com/
 &ShowHowMany=5
 &_id=390e906036f48772b2ed4b5d837af4cd
 &_callback=getYpipePP
 &_render=json"
type="text/javascript"></script>
<span style="font-size: 70%; float:right;"><a href="http://www.romelteamedia.com">Most Commented Post Widget</a></span>


4. Ganti alamat blognya (yang warna merah)
5. Save!

KODE LAIN
Jika kode di atas gak works alias gak cocok dengan blog Anda, berikut ini kode Most Commented Posts yang saya pasang di footer:

<div id="most-comments"></div>
<style scoped='' type='text/css'>
#most-comments li,#most-comments ul,#most-comments ul li{margin:0;list-style:none;color:#444;font-family:'Open Sans',Helvetica,Arial,sans-serif;font-size:14px}#most-comments ul li{position:relative;overflow:hidden;background:#fff;margin:3.5px 0;padding:7px 10px 7px 50px;white-space:nowrap;text-overflow:ellipsis;box-shadow:inset 0 0 #fc4f3f;border:1px solid #e6e6e6;transition:all .6s}#most-comments ul li:hover{box-shadow:inset 310px 0 #fc4f3f}#most-comments ul li a{color:#444;font-weight:700;text-decoration:none;transition:all .3s}#most-comments ul li a:hover,#most-comments ul li:hover a{color:#fff}.count-most{position:absolute;left:0;top:0;width:40px;height:100%;margin:0;padding:7px 0;background-color:#383838;color:#fff!important;text-align:center;transition:all .3s}#most-comments ul li:hover .count-most{background-color:#fc4f3f}
</style>
<script type='text/javascript'>
//<![CDATA[
var numPosts=5;
var homePage="www.romelteamedia.com";
var postTitlear=new Array();
var postUrlar=new Array();
var postCommentar=new Array();
var totalpost;document.write('<div id="most-comments"><ul>');
function mostComment(j){var a=j.feed.entry.length;totalpost=a;
for(var f=0;f<a;f++){
var h=j.feed.entry[f];
var c=h.title.$t;var b;
var g;if(f==j.feed.entry.length){break}
for(var d=0;d<h.link.length;d++){
if(h.link[d].rel=="alternate"){g=h.link[d].href;break}}
for(var d=0;d<h.link.length;d++){
if(h.link[d].rel=="replies"&&h.link[d].type=="text/html"){b=h.link[d].title.split(" ")[0];}};
postTitlear.push(c);
postUrlar.push(g);
postCommentar.push(b)}sortPosts();
for(var f=0;f<numPosts;f++){var e='<li><span class="count-most">'+postCommentar[f]+'</span><a href="'+postUrlar[f]+'" title="'+postTitlear[f]+'" target="_blank">'+postTitlear[f]+'</a>';
document.write(e)}}
function sortPosts(){function c(d,f){var e=postTitlear[d];
postTitlear[d]=postTitlear[f];
postTitlear[f]=e;
var e=postUrlar[d];
postUrlar[d]=postUrlar[f];
postUrlar[f]=e;
var e=postCommentar[d];
postCommentar[d]=postCommentar[f];
postCommentar[f]=e}
for(var b=0;b<postTitlear.length-1;b++){
for(var a=b+1;a<postTitlear.length;a++){
if(parseInt(postCommentar[b])<parseInt(postCommentar[a])){c(b,a)}}}}
document.write('<script src="http://'+homePage+'/feeds/posts/default?max-results=9999&orderby=published&alt=json-in-script&callback=mostComment"><\/script>');
document.write('</li>')
document.write('</ul>')
document.write('</div>');
//]]>
</script>

Ganti alamat blognya (yang warna merah) dan Save! Kini Most Commented Posts sudah muncul di blog Anda. (http://www.romelteamedia.com/).*

Sumber 
Sumber Keneh

Author:

I am a Blogger, Media Practisioner, and Practical Communication Trainer. I share my own knowledges, experiences, and skills about practical communication - writing, speaking, blogging - and my hobbies and concerns. Visit my official website Romeltea.

Previous
« Prev Post
0 Komentar untuk "Menampilkan Daftar Posting Blog Paling Banyak Dikomentari"

You comment, I'll visit back your blog. If you have one. Komentar SPAM dan LINK AKTIF tidak akan muncul.