Skip to main content

Membuat "read more" Tanpa Harus Memotong Postingan (Auto)

untuk versi Auto Read More terbaru kali ini sepertinya lebih canggih, karena fungsi pemenggalan kalimat langsung bekerja secara otomatis tanpa harus memotong postingan.

Fungsi Read More ini mampu menampilkan image pertama dalam postingan dan mem-fload image tersebut di awal paragraf awal, meskipun gambar yang kita letakan berada di tengah atau akhir postingan. Mungki lebih nyaman saya sebut saja dengan fasilitas image thumbnail.

Kita dapat juga pengatur jumlah karakter yang ditampilkan. Disini ada 2 pilihan untuk jumlah karakter. Yang pertama, jumlah karakter yang ditampilkan jika ada image yang diikutsertakan dalam postingan dan yang kedua jumlah karakter tanpa image.
Daripada berbengong ria.. langsung tes aja x yah...

Pertama, langsung ke halaman EDIT HTML, Cari kode </head> kemudian letakan script dibawah ini di atas kode </head> Kalo sudah, jangan lupa di simpan terlebih dahulu.

<script type='text/javascript'>
var thumbnail_mode = "float" ;
summary_noimg = 250;
summary_img = 250;
img_thumb_height = 120;
img_thumb_width = 120;
</script>

<script type='text/javascript'>
//<![CDATA[
/******************************************
Auto-readmore link script, version 2.0 (for blogspot)

(C)2008

visit http://en.vietwebguide.com to get more cool hacks
********************************************/
function removeHtmlTag(strx,chop){
if(strx.indexOf("<")!=-1)
{
var s = strx.split("<");
for(var i=0;i<s.length;i++){
if(s[i].indexOf(">")!=-1){
s[i] = s[i].substring(s[i].indexOf(">")+1,s[i].length);
}
}
strx = s.join("");
}
chop = (chop < strx.length-1) ? chop : strx.length-2;
while(strx.charAt(chop-1)!=' ' && strx.indexOf(' ',chop)!=-1) chop++;
strx = strx.substring(0,chop-1);
return strx+'...';
}

function createSummaryAndThumb(pID){
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length>=1) {
imgtag = '<span style="float:left; padding:0px 10px 5px 0px;"><img src="'+img[0].src+'" width="'+img_thumb_width+'px" height="'+img_thumb_height+'px"/></span>';
summ = summary_img;
}

var summary = imgtag + '<div>' + removeHtmlTag(div.innerHTML,summ) + '</div>';
div.innerHTML = summary;
}
//]]>
</script>

Masih pada halaman EDIT HTML, Beri tanda centang pada "Expand widget template" lalu temukan kode seperti dibawah

<data:post.body/>

ganti menjadi

<b:if cond='data:blog.pageType != "item"'>
<div expr:id='"summary" + data:post.id'><data:post.body/></div>
<script type='text/javascript'>createSummaryAndThumb("summary<data:post.id/>");</script>
<span class='rmlink' style='float:left'><a expr:href='data:post.url'>READ MORE - <data:post.title/></a></span>
</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'><data:post.body/></b:if>

silahkan disimpan dan lihat hasilnya..

Keterangan:

var thumbnail_mode = "float"; (kita dapat memutuskan apakah letak thumbnail berada di (float) kiri atau jika tidak silahkan ganti dengan (no-float)
summary_noimg = 250; (Menetapkan berapa banyak karakter akan ditampilkan di posting tanpa gambar / thumbnail)
summary_img = 250; (Menetapkan berapa banyak karakter akan ditampilkan di posting dengan gambar / thumbnail)
img_thumb_height = 120; (Thumbnail 'tinggi dalam piksel)
img_thumb_width = 120; (Thumbnail 'lebar dalam piksel)

Comments

Popular posts from this blog

Counter Strike Extreme V7 Remake by Bricks_966

Title: COUNTER-STRIKE XTREME V7 Released: 2013 Genre: Action (Shooter), 3D, 1st Person Developer: bluelytning Publisher: CS-XTREME.ORG Translation: Bricks_966 Language: Russian Language: English Publication Type: pirates Tablet: Not required. Description: I present you the new version of the game - Counter-Strike Xtreme v7. Now added more than 60 new models of weapons and the players that can not but rejoice. The game has changed beyond recognition in the store became available new weapons and players that make the game even brighter and more exciting. Also changed logos, textures, sprites and sounds. But with new features, new, specific requirements for rail component of your computer. Counter-Strike Xtreme v7 is markedly different from previous builds the world-famous fashion Half-Life. The first thing that catches your eye - it's graphics. It has become more colorful through changes in the composition of new t

Counter Strike Extreme Ultimate by Bluelytning

Title: COUNTER-STRIKE XTREME ULTIMATE Released: 2013 Genre: Action (Shooter), 3D, 1st Person Developer: bluelytning Publisher: CS-XTREME.ORG Translation: bluelytning Language: English Language: English Publication Type: pirates Tablet: Included Features COUNTER-STRIKE XTREME ULTIMATE: 1. New Menu Launch 2. New maps and full radar system cards 3. New Modes 4. New weapons now available to all and always 5. Full gun shop 6. Weapons heroes now available 7. New models Yuri & Alice Casual 8. Updated scoreboard 9. Life zombies and updated hero 10. New Animation & Effect and many, many other upgrades! * Tested in Windows Xp Sp3 * Source : http://cs-xtreme.org/forum/2-49-1 * DOWNLOAD 

Counter Strike Point Blank Non NST

========================================================================= UPDATE !!! PATCH FOR CSPB NON NST Info: Patch diinstall jika CSPB dipasang STEAM ! Link: Mediafire 17.7 MB ========================================================================= NEW PATCH 18 June 2012 FOR CSPB NON NST Credits: DavidJr Fe Ar Padli Koesmayadi Arif Super Insurgent KeenHide Syahrul Ramdhan Allied Modder Link: Mediafire 1.41 MB ========================================================================= Tutor how to install patch 1. Buka patchnya lalu arahkan ke folder CSPB Non NST 2. Jika keluar dialog seperti ini, tekan Yes to all: Tester: DavidJr Progress project bisa dilihat di: CSF Project Produced by CSPB Team under Counter Strike Federation Foundation Copyright. Counter Strike Point Blank is a trademark of Counter Strike Federation & Valve Trademark Please note this: Do not reupload ! Do not post any direct link ! Copyright © 2012 C