Featured Image a.k.a Post Thumbnail adalah fitur wordpress untuk menampilkan gambar artikel di halaman awal secara mudah, tanpa perlu menggunakan custom field dan mengisikan tautan file gambar yang akan ditampilkan. Featured Image, sebenarnya sudah diperkenalkan sejak WordPress 2.9.0. Hanya saja fitur ini baru terkenal sejak kehadiran WordPress 3.0 dengan theme bawaan Twenty-Ten, sebab theme ini sudah mengusung fitur Featured Image.
Misal theme blog sudah cocok dan tak ingin ganti, bisa menambah fitur Featured Image di halaman depan wordpress, termasuk halaman kategori, tag, arsip. Berikut langkah mudahnya:
- Pertama masukkan kode berikut dalam file function.php theme[sourcecode language="php" wraplines="false"]
<?php
add_theme_support( ‘post-thumbnails’ );
?>
[/sourcecode] - Masukkan tag [sourcecode language="php" light="true" wraplines="false"]
<?php the_post_thumbnail(); ?>
[/sourcecode]dalam file index.php sebelum tag
[sourcecode language="php" light="true" wraplines="false"]
<?php the_content(); ?>
[/sourcecode]menjadi
[sourcecode language="php" wraplines="false"]
…
<?php the_post_thumbnail(); ?>
<?php the_content(); ?>
…
[/sourcecode] - Masukkan gambar yang akan ditampilkan sebagai Featured Image di halaman add new post

- Done!
Langkah yang cukup mudah bukan? Kalau kurang cocok, tinggal atur css atau tentukan ukuran Featured Image dengan menambahkan attribut
[sourcecode language="plain" light="true" wraplines="false"]
array(x,y)
x: lebar (integer)
y: panjang (integer)
[/sourcecode]
menjadi:
[sourcecode language="php" light="true" wraplines="false"]
<?php the_post_thumbnail( array(150,150) ); ?>
[/sourcecode]
Parameter lainnya:
[sourcecode language="php" light="true" wraplines="false"]
the_post_thumbnail(); // without parameter -> Thumbnail
the_post_thumbnail(‘thumbnail’); // Thumbnail
the_post_thumbnail(‘medium’); // Medium resolution
the_post_thumbnail(‘large’); // Large resolution
the_post_thumbnail( array(100,100) ); // Other resolutions
[/sourcecode]
sumber: http://codex.wordpress.org/Function_Reference/the_post_thumbnail



