Friday, February 4, 2011

Pasang Related Post Per Label/Kategori




Agar lebih joss, related post yang udah di pasang dengan yang versi thumbnail, sebaiknnya di lengkapi dengan yang versi per label, sehingga akan mudah untuk pembaca dalam mencari artikel berdasarkan ketegori tersebut. Langsung saja caranya :


1. Login Blogger => “TEMPLATE”=> “EDIT HTML”
2. Klik “Expand Widget“.
3. Backup dulu template sebelumnya :)
4. Cari kode <data:post.body/>
5. Copy + Paste kode Java Script di bawah dan letakkan setelah kode <data:post.body/> di atas.
6. Pekerjaan selesai!



<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div class='similiar'>


<div class='widget-content'>
<b>Postingan Terkait Lainnya Dengan Label :</b>
<div id='data2007'/><br/><br/>
<div id='Randezvous'>
Edited by <u><a href='http://putraokutimur.blogspot.com/' target='_blank'>Tutorial Blog</a></u>
</div>
<script type='text/javascript'>

var homeUrl3 = &quot;<data:blog.homepageUrl/>&quot;;
var maxNumberOfPostsPerLabel = 4;
var maxNumberOfLabels = 10;

maxNumberOfPostsPerLabel = 100;
maxNumberOfLabels = 3;


function listEntries10(json) {
var ul = document.createElement(&#39;ul&#39;);
var maxPosts = (json.feed.entry.length &lt;= maxNumberOfPostsPerLabel) ?
json.feed.entry.length : maxNumberOfPostsPerLabel;
for (var i = 0; i &lt; maxPosts; i++) {
var entry = json.feed.entry[i];
var alturl;

for (var k = 0; k &lt; entry.link.length; k++) {
if (entry.link[k].rel == &#39;alternate&#39;) {
alturl = entry.link[k].href;
break;
}
}
var li = document.createElement(&#39;li&#39;);
var a = document.createElement(&#39;a&#39;);
a.href = alturl;

if(a.href!=location.href) {
var txt = document.createTextNode(entry.title.$t);
a.appendChild(txt);
li.appendChild(a);
ul.appendChild(li);
}
}
for (var l = 0; l &lt; json.feed.link.length; l++) {
if (json.feed.link[l].rel == &#39;alternate&#39;) {
var raw = json.feed.link[l].href;
var label = raw.substr(homeUrl3.length+13);
var k;
for (k=0; k&lt;20; k++) label = label.replace(&quot;%20&quot;, &quot; &quot;);
var txt = document.createTextNode(label);
var h = document.createElement(&#39;b&#39;);
h.appendChild(txt);
var div1 = document.createElement(&#39;div&#39;);
div1.appendChild(h);
div1.appendChild(ul);
document.getElementById(&#39;data2007&#39;).appendChild(div1);
}
}
}
function search10(query, label) {

var script = document.createElement(&#39;script&#39;);
script.setAttribute(&#39;src&#39;, query + &#39;feeds/posts/default/-/&#39;
+ label +
&#39;?alt=json-in-script&amp;callback=listEntries10&#39;);
script.setAttribute(&#39;type&#39;, &#39;text/javascript&#39;);
document.documentElement.firstChild.appendChild(script);
}

var labelArray = new Array();
var numLabel = 0;

<b:loop values='data:posts' var='post'>
<b:loop values='data:post.labels' var='label'>
textLabel = &quot;<data:label.name/>&quot;;

var test = 0;
for (var i = 0; i &lt; labelArray.length; i++)
if (labelArray[i] == textLabel) test = 1;
if (test == 0) {
labelArray.push(textLabel);
var maxLabels = (labelArray.length &lt;= maxNumberOfLabels) ?
labelArray.length : maxNumberOfLabels;
if (numLabel &lt; maxLabels) {
search10(homeUrl3, textLabel);
numLabel++;
}
}
</b:loop>
</b:loop>
</script>
</div>

</div>
</b:if>

7. Simpan

0 komentar:

Post a Comment

Webmaster Forum

Categories

Action (6) add-ons (2) Adventure (3) Advertising (3) affiliate programs (2) algoritma dan pemrograman 1 (4) algoritma dan pemrograman 2 (3) Aljabar Linier Matriks (2) aplikasi (12) array (2) Basis Data (3) basis data. programming project (1) berita (1) browser (3) bug (1) buku tamu (1) Business (2) c++ (1) CERITA LUCU (3) clone (1) cms (9) Comedy (1) commedy (1) Computers (3) corel draw (1) Database (3) desktop (1) domain (1) Drama (3) Dreamweaver (3) driver (1) E-book (43) E-book Adsense (2) e-book hacking (4) E-book Humor (1) E-book Islam (1) E-book Jaringan Komputer (1) E-book Kesehatan (1) E-book Komputer (23) E-Book Pekerjaan (2) e-book photoshop (4) Entertainment (1) etika (1) exploit (5) facebook (5) Fantasy (2) firefox (2) Forum (1) gambar (1) Games (2) gitar (1) grafis (1) Hack (1) hacking (15) hacking joomla (2) Hacking Wordpress (3) HANDPHONE (12) hollywood (7) hosting (3) HUMOR (3) indonesia (1) internet (46) iseng (3) Islam (1) jaringan (2) java games (1) kata mutiara (1) Komputer (8) Komputer. open source (1) lan (1) Linux (4) majalah (1) Marketing (2) materi kuliah (15) Media (1) Money (2) movie (7) Mp3 (2) music (1) MySql (2) Mystery (1) networking (2) Open Source (13) Oracle (1) pemrograman non prosedural (3) pemrograman shell (1) Pengantar Teknologi Informasi (2) pengertian (1) photo design (1) photoshop (4) PHP (2) problem solving (1) Products (3) Programming (3) prolog (3) sahabat (1) Sci-Fi (3) script (4) Search Engine Optimization (5) security (7) SEKOLAH (1) seo (3) Services (3) seven (1) Shopping (1) sistem operasi (2) situs ngetop (2) SMS (3) SNMPTN (1) SOFTWARE (33) spam (1) SQL (1) streaming (1) Super Heroes (1) tampilan (1) Thriller (3) tips (1) Tips dan Trik (74) Trik Windows XP (15) Tutorial blog (18) tutorial drupal (2) tutorial html (2) Tutorial Joomla (14) tutorial moodle (1) tutorial wordpress (9) TV (1) ubuntu (13) UII (1) wall (1) wap (1) Web Design (33) web programming (2) webcam (1) Webdesign (1) youtube (1)
 
FREE AND HAPPY ALWAYS Copyright © 2009-2010 Blogger Template Designed by Bie Blogger Template

PUTRA OKU TIMUR BLOG FRIENDS
Reviews Music Indie Oku Timur||Campang Tiga||Ato||Daryanto||Tax||Shasya||Dewi||Fajar||Hendrie||Ria Imut||My Own Gallery||Penulis Mania||Saung Web||Ipan||Goceng Blog||Guntur Setyo||Mundo Belitang||Edwar||Teknologi||seo||eno||oob||Black Warrior||Wardi Sukoharjo||Chef Krendo||Maranai||prost||Traveller||Mas Muji||Pambudi||Pandu||Kabar Maya||Lie||Harnet||rayapost||juandry||fianmuse||inipulsaku||Tips dan Trik Blogging||Hidup Sehat||sastrafresh||Martapura Blogger||Salsa Kids||
Nofasonic WeblogPhotobucketBlog Directory Cara Membuat Blog EBOOK GRATISBlog Ratings'WavyKomunitas Blogger WongKito