Cara Membuat Related Post | ™Gusti™
Login ke Blogger >> Template. Tekan Edit HTML >>.
Sorot semua kode dibawah,
dan Kopikan semua kode diatas pas dibawah kode :
<div class='post-footer-line post-footer-line-3'/>
</div>
Sorot semua kode dibawah,
<b:if cond='data:blog.pageType == "item"'>
<style type='text/css'>
.custom_images ul {display:inline; list-style:none}
.custom_images ul li {float:left; margin-right:1px}
#related-posts{ float: left; margin: 50px 0 0; width: 500px;}
#related-posts h2 {color: #444; font-family: Segoe UI,Arial; font-size: 30px; font-weight: normal; margin: 0; padding: 0 0 10px; text-align: left; text-transform: none;}
#related-posts h4 {font-size:1.4em; font-weight:normal}
#related-posts h5 {font-size:1.17em; font-weight:normal}
#related-posts h4, #related-posts h5 {margin: 0.3em 0px}
#related-posts ul{list-style-type: none; margin-left: -48px; width: 650px;}
#related-posts ul li{position:relative;float:left;border:0 none;margin:0px 20px 0px 10px;width:150px}
#related-posts ul li:hover{z-index:98}
#related-posts ul li:hover div{position:absolute;top:50px;center:10px;margin-left:0;width:200px}
#related-posts ul li img{background: #fff; width:150px; height:150px;}
#related-posts ul li div{position:absolute;z-index:99;margin-left:-999em}
#related-posts ul li .title{background:#f9f9f9;padding:5px 10px}
</style>
<div style='clear:both'/>
<div id='related-posts'>
<script type='text/javascript'>var ry='<h2>Related Posts</h2>';rn='<h2>None Realated Posts</h2>';rcomment='Comments';rdisable='No Comments';commentYN='yes';</script>
<script type='text/javascript'>
//<![CDATA[
var nothumb='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdmf8XfslqqUA0Di8W9yhRLVeF07lIxV1Ef_NDT8R-8hdvcoYgSMIDy-_Yvy8xoasJmm-7iHAPoZuqPnrhBFIhNnZ04OyeFAGVTM3khZj86Cho8E7kExuCsl2qH7eESMylklJfo1IZfSo/s200-c/last%2528gr%2529256.jpg';dw='';titles=new Array();titlesNum=0;urls=new Array();time=new Array();thumb=new Array();commentsNum=new Array();comments=new Array();function related_results_labels(c){for(var b=0;b<c.feed.entry.length;b++){var d=c.feed.entry[b];titles[titlesNum]=d.title.$t;for(var a=0;a<d.link.length;a++){if('thr$total' in d){commentsNum[titlesNum]=d.thr$total.$t+' '+rcomment}else{commentsNum[titlesNum]=rdisable};if(d.link[a].rel=="alternate"){urls[titlesNum]=d.link[a].href;time[titlesNum]=d.published.$t;if('media$thumbnail' in d){thumb[titlesNum]=d.media$thumbnail.url}else{thumb[titlesNum]=nothumb};titlesNum++;break}}}}function removeRelatedDuplicates(){var b=new Array(0);c=new Array(0);e=new Array(0);f=new Array(0);g=new Array(0);for(var a=0;a<urls.length;a++){if(!contains(b,urls[a])){b.length+=1;b[b.length-1]=urls[a];c.length+=1;c[c.length-1]=titles[a];e.length+=1;e[e.length-1]=time[a];f.length+=1;f[f.length-1]=thumb[a];g.length+=1;g[g.length-1]=commentsNum[a]}}urls=b;titles=c;time=e;thumb=f;commentsNum=g}function contains(b,d){for(var c=0;c<b.length;c++){if(b[c]==d){return true}}return false}function printRelatedLabels(a){var y=a.indexOf('?m=0');if(y!=-1){a=a.replace(/\?m=0/g,'')}for(var b=0;b<urls.length;b++){if(urls[b]==a){urls.splice(b,1);titles.splice(b,1);time.splice(b,1);thumb.splice(b,1);commentsNum.splice(b,1)}}var c=Math.floor((titles.length-1)*Math.random());var b=0;if(titles.length==0){dw+=rn}else{dw+=ry;dw+='<ul>';while(b<titles.length&&b<20&&b<maxresults){if(y!=-1){urls[c]=urls[c]+'?m=0'}if(commentYN=='yes'){comments[c]=' - '+commentsNum[c]}else{comments[c]=''};dw+='<li><a href="'+urls[c]+'" rel="nofollow"><img alt="'+titles[c]+'" src="'+thumb[c]+'"/></a><div class="title"><h4><a href="'+urls[c]+'" rel="nofollow">'+titles[c]+'</a></h4><h5>'+time[c].substring(8,10)+'/'+time[c].substring(5,7)+'/'+time[c].substring(0,4)+comments[c]+'</h5></div></li>';if(c<titles.length-1){c++}else{c=0}b++}dw+='</ul>'};urls.splice(0,urls.length);titles.splice(0,titles.length);document.getElementById('related-posts').innerHTML=dw};
//]]>
</script>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name != "Guest Posts"'>
<b:if cond='data:label.name != "Feature"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels"' type='text/javascript'/>
</b:if></b:if>
</b:loop>
<script type='text/javascript'>var maxresults=3;removeRelatedDuplicates();printRelatedLabels('<data:post.url/>');</script>
</div>
<div style='clear:both'/>
<script type='text/javascript'>
//<![CDATA[
function replaceText(){if(!document.getElementById){return;}
bodyText = document.getElementById("related-posts");
theText = bodyText.innerHTML;
theText = theText.replace(/s72-c/gi, "s200-c");
bodyText.innerHTML = theText;
}replaceText();
//]]>
</script>
</b:if>
dan Kopikan semua kode diatas pas dibawah kode :
<div class='post-footer-line post-footer-line-3'/>
</div>
Post a Comment