Subscribe via RSS Feed

Gayakan Blog Korang Dengan Thumbnail !! (WordPress)

A’kum & selamat sejahtera tuan2 & puan2 sekalian alam maya ni.. Al-kisah………………. Taib………………… Post kali ni adalah post tutorial ataupun guide mcm mna nk letak thumbnail dekat blog korang (post thumbnail untuk theme yg x der post thumbnail).. Ni tutorial untuk self-hosted wordpress jer bukan untuk *.wordpress.com mahupun *blogspot.com.. Sila jgn tnya aku pasal blogspot sbb aku x penah guna blogspot so aku x tau selok-belok untuk blogspot.. =(

Pada pendapat aku la.. Contohnya kita letak gambar besar untuk mana2 post, mesti blog kita akan terlalu memanjang ke bawah right? Jenuh lah nk scroll right? Sbb tu aku lagi suka guna thumbnail so blog aku ni kurang skit semaknya.. Btw klau pkai thumbnail ni, pageload pun kurang skit beratnya sbb gmbar kecik.. Klau pkai gmbar besar dekat main page, pageload berat skit.. Dah la connection internet ntah hapa2 ni.. :cool:

THE GUIDE

Part 1 : Set Up

Firstly, pegi ke : TimThumb Code and then copy smua code yg ada kt page tu dari atas smpai bawah (CTRL+A) & then paste dekat Notepad pastu save as timthumb.php .. Kemudian, create satu folder dalam folder theme yg korang pakai tu, letak nama “scripts“.. Upload file timthumb.php td ke dlm folder “scripts” yg baru korang create td.. Contoh :

1
http://yourdomain.tld/wp-content/themes/your-theme/scripts/timthumb.php

After that, create satu lagi folder dlm folder “scripts” (sub-folder) ni & letak nama “cache“.. CMOD kan folder “cache” tu kepada permission 777 ataupun 0777..

Part 2 : Implementing TimThumb

Masuk dlm folder theme korang & cari file home.php ataupun index.php.. Tengok lah mana satu file yg betul untuk korang modified.. Klau boleh buat backup dlu theme korang tu takut korang salah modified.. Jgn takut untuk mencuba.. Kita belajar dari kesilapan..

Cuba cari code lebih kurang mcm ni :

1
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>

Bila dah jumpa code yg lebih kurang mcm tu (lebih kurang sbb x smua theme sama/ creator/theme lain2..), letak salah satu dari 2 call function di bawah..

Code 1 : Static Thumbnail

1
2
3
4
5
<?php if ( get_post_meta($post->ID, 'thumb', true) ) { ?>
	<div class="postthumb"> 
		<img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=150&w=150&zc=1" alt="<?php the_title(); ?>" width="100" height="57" />
	</div>
<?php } ?>

Code 2 : Clickable Thumbnail (Thumbnail > Post)

1
2
3
4
5
<?php if ( get_post_meta($post->ID, 'thumb', true) ) { ?>
	<div class="postthumb"> 
		<a href="<?php&phpMyAdmin=410c4af8e9e6t1397404&phpMyAdmin=446c4b004362t3f340eda the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=150&w=150&zc=1" alt="<?php the_title(); ?>" width="150" height="150" /></a> 
	</div>
<?php } ?>

Part 3 : Using The Custom Fields

1 – Letak title post dlu..
2 – Upload gambar yg korang nk guna..
3 – Dekat panel “Custom Fields” ada tulis “Add New Custom Field :”.. Enter New dekat bahagian “Name”, taip kt situ “thumb”
4 – Bahagian kanan dia plak yang “Value” tu letak URL penuh gambar.. Contoh :

1
http://kertaz.net/wp-content/uploads/2009/12/timthumb.jpg

5 – Click “Add Custom Field”..

Part 4 : Customizing Thumbnail Size

Klau korang nk modified size thumbnail tu bagi sesuai dengan blog korang, Edit code yg korang letak dekat index.php / home.php td.. Cari width=”150″ height=”150″ & modified ah ke saiz yg sesuai..

Kalau ada apa2 problem masa try nk guna timthumb ni jgn segan2 drop komen kt bawah pasal problemnya.. Insyallah aku bleh tlong stakat yg mampu.. Sekian.. :)

Comments (7)

Trackback URL | Comments RSS Feed

  1. KertaZ says:

    @apsal berasap? :aie:

  2. naz says:

    satu lg cara mudah pakai plugin thumb wp. easy as peanut. teh o ais satu! 8) naz´s last blog ..Twitter got pwned!

  3. KertaZ says:

    Theme lama aku sblum ni x support plugin thumb wp tu.. So aku pkai manual.. Kompom fully functional..

  4. oh!dawie says:

    aku xbrape phm la psl nie bro..leh xplain sket x?
    oh!dawie´s last blog ..Contest : RM50 untuk dimenangi

  5. Akmal Hisyam says:

    yeah..thnx for the tuts..
    blog aku pakai makhluk timthumb ni…

    rasanya wordpress 2.9 ada function utk define post thumbnail..
    tp aku x tau r..x explore lg..
    Akmal Hisyam´s last blog ..WordPress 2.9 “Carmen” Dikeluarkan

  6. KertaZ says:

    Wokeh.. TimThumb ni kiranya mcm plugin lah untuk wordpress tp dia bukan plugin.. Gunanya untuk buat thumbnail untuk post.. For example lepas ko setup smua dkt atas ni, then dekat post ko letak dekat gambar yg saiz dia 1000x1000px contohnya.. Tp thumbnail ko tu ko set untuk display saiz 180x180px jer.. So timthumb ni akan automaticly resize gambar td ke saiz 180x180px..

    Contoh mudah lah.. Ko tengok thumbnail post ni.. Yg gmbar logo wp tu.. Ko right click kt gambar tu & tekan copy image location.. Open new tab then paste (ctrl+v).. Hit enter.. Tengok gambar ori dengan gmbar thumbnail.. Sama x saiz? ;)

Leave a Reply




CommentLuv Enabled
:p 8) :lol: =( :8 ;) :(( :o: :[ :) :D :-| :-[) :bloody: :cool: :choler: :love: :oups: :aie: :beurk: