How to add thumbnail image to a post
Monday, July 14, 2008 20:47Berikut tutorial singkat cara menambahkan sebuah gambar kecil (thumbnail) kedalam daftar postingan disebuah blog yang menggunakan WordPress CMS dengan memanfaatkan custom fields _nya. Saya tidak akan membahas tentang custom fields itu sendiri, karena akan membuat kita pusing sendiri dalam memahami maupun menerapkannya kedalam blog kita, maklum aku juga masih newbie dibidang WordPress
WordPress has the ability to allow post authors to assign custom fields to a post. This arbitrary extra information is known as meta-data. Meta-data is handled with key/value pairs. The key is the name of the meta-data element. The value is the information that will appear in the meta-data list on each individual post that the information is associated with.
Itulah sedikit gambaran tentang custom fields yang saya temukan di sini
Langsung saja, berikut langkah-langkah yang perlu anda diikuti:
1. Bukalah file style.css yang ada di folder WordPress theme blog anda dengan dengan notepad,
dan tambahkan kode css berikut di dalam file style.css tersebut, lalu simpan:
img.kiri {
margin: 0 10px 0 0;
float: left; padding: 4px;
border: 1px solid #b3d2fc;
background: #fff;
width:100px; height:100px;
}
2. Masih di folder theme WP anda, selanjutnya bukalah file index.php
Temukan baris dan code berikut:
<?php the_content('Read the rest of this entry »'); ?>
Lalu gantilah dengan code berikut:
<?php
$values = get_post_custom_values("thumbnail");
if (isset($values[0])) {
?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<img class="kiri"
src="<?php $key="thumbnail"; echo get_post_meta($post->ID, $key, true); ?>"
alt="<?php the_title(); ?>" /></a>
<?php } ?>
<?php the_content('Read the rest of this entry »'); ?>
Setelah selesai simpanlah.
3. Terapkan langkah ke-2 ke file-file archive.php dan search.php jika perlu.
4. Selanjutnya upload file-file tersebut ke server hosting anda.
5. Saatnya menerapkannya pada postingan anda, cobalah buka salah satu postingan artikel blog anda, dan buatlah sebuah image (gambar) kecil, dalam contoh ini menggunakan ukuran 100pixel x 100pixel dan uploadlah seperti biasa, dalam hal ini anda hanya perlu mengetahui URL file gambar thumbnail tersebut.

6. Terakhir tambahkanlah URL thumbnail gambar tersebut di custom fields, dengan Key: thumbnail dan Value: URL dari gambar thumbnail tadi dengan cut and paste saja, lalu klik tombol “Add Custom Field”. Selanjutnya Save dan lihatlah hasilnya. Jika berhasil anda akan melihat postingan tersebut sudah berisi gambar kecil disebelah kirinya.

Selamat mencoba dan semoga berhasil!
p.s. Klik disini agar tampilan source code_nya lebih enak















Rivermaya says:
August 11th, 2008 at 8:35 pm
Terima kasih kode tambahannya
Rivermayas last blog post..Menyembunyikan Kategori Tertentu
Reply
Permana Jayanta says:
August 27th, 2008 at 9:25 am
Hehehe … nice inpo …
Tapi pake edit2x kodenya ya … ntar klo ganti theme jd bgg …
Btw, boleh tuh klo ditambahin screenshot hasilnya klo sdh jadi
Permana Jayantas last blog post..Bermain dengan warna
Reply
474849 says:
September 11th, 2008 at 2:17 pm
Wah, keren bgt nih tutorialnya….
makasih banyak ya om ^^!
474849s last blog post..Dr Jekyll and Mr Hyde
Reply
Escort Directory London says:
October 8th, 2008 at 11:49 pm
Thanks I have always wondered how to do this in wordpress. THis will come in useful for our escort blog.
Reply
ide says:
October 24th, 2008 at 2:11 pm
Thanks mas. Menambah khasanah pengetahuan ttg wordpress nih
ides last blog post..StatPress plugins Wordpress
Reply
hendra says:
November 13th, 2008 at 12:02 am
om ini source kodenya di klik kok ga’ muncul om ?
hendras last blog post..TESTOMONIAL WINDOWS 7
Reply
ooopinionsss says:
December 3rd, 2008 at 10:43 pm
How you think when the economic crisis will end? I wish to make statistics of independent opinions!
Reply
mogoku says:
March 3rd, 2009 at 1:57 pm
buth lolak ibe butuh……..bagus gambarmu
Reply
Envy says:
March 10th, 2009 at 11:46 pm
Thank you for your help!
Reply
raquo says:
December 20th, 2009 at 10:34 pm
Designer to fit, not mean they?? to create, of the vat.Her to come, with the Authurian.Had The problem raquo, most regular bad genetic disorder as.Side with your, you stop working.,
Reply
Affiliate says:
January 15th, 2010 at 4:05 am
Affiliate Crunch…
I saw this really good post today….