// you’re reading...

Fireworks

Menampilkan image dengan custom field di Wordpress 2.7.1

Menampilkan image thumbnail dari setiap post di halaman depan blog. Untuk Wordpress 2.7.1

The X Files dvd

Contoh:

1a download Juice movie

screenshot from x-phoneshop.com

Gundam Wing: Endless Waltz download

Pada WP Admin, pilihlah salah satu post yang akan dibuatkan image thumbnail-nya untuk dimunculkan di halaman depan.

Fifty Pills trailer

Zombi 2 film

  1. Dalam menu edit sebuah post, buatkan custom field pada sebuah post dengan key “the_excerpt_image ” pada menu custom field di bagian bawah halaman edit post.
  2. 2
  3. Upload image dengan ukuran thumbnail (besar pixel width dan height bebas sesuai theme), lalu gunakan fungsi upload pada wp-admin untuk meletakkan image tersebut di wp-content/uploads.
  4. Copy URL image location dari hasil upload tersebut. Contoh url location:  http://localhost/wordpress27/wp-content/uploads/2009/01/sony_ericsson_w902_thumb.jpg
  5. Pada custom field dengan key “the_excerpt_image” yang tadi dibuat, buatkan code html untuk menampilkan image pada kolom value di sebelahnya. Contoh: <img src="" alt=""/>
  6. Paste url location image-nya di tag src=”". Contoh: <img src="http://localhost/wordpress27/wp-content/uploads/2009/01/sony_ericsson_w902_thumb.jpg" alt="image"/>
  7. Klik tombol Update post untuk menyimpan hasil editing barusan.
  8. Pada menu admin, bukalah Editor yang ada di dalam menu Appereance untuk mengedit file themes.
  9. Pilih file index.php (Main index template). Kita akan menambahkan sebaris code php untuk menampilkan image di dalam custom field tadi.
  10. Di dalam file index.php, temukan baris code <?php if (have_posts()) : while (have_posts()) : the_post(); ?>.  Baris ini adalah baris awal fungsi loop wordpress yang menampilkan semua post di halaman depan. Sebelumnya, pastikan CHMOD file index.php ke 777 untuk membuat file ini editable. Lalu copy code ini:

//show small image from custom field
T.A.C.T.I.C.A.L. move
$key=”the_excerpt_pict”;
echo get_post_meta($post->ID, $key, true);
?>


dan kemudian paste di dalam loop dimana thumbnail image tadi akan dimunculkan. Contoh:


<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

Hard to Kill move
Inkheart movie download Face/Off hd

<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h2>

Between Strangers movie download

Method full movie Godspeed psp
<small><?php the_time(’F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

<div class="entry">
<?php

//show small image from custom field the_excerpt_pict

The Amityville Horror psp


$key=”the_excerpt_pict”;
echo get_post_meta($post->ID, $key, true);
The Day After Tomorrow psp
?>
<?php the_content(’Read the rest of this entry &raquo;’); ?>
</div>

<p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p>
</div>

<?php endwhile; ?>

8MM 2 on dvd

Gutterballs video

<?php else : ?>


notes:  loop di atas diambil dari index.php dari themes default wordpress

10. Klik tombol Update file untuk menyimpan hasil editing pada file index.php barusan.

11. Refresh halaman depan blog Anda untuk melihat hasilnya.

Discussion

4 comments for “Menampilkan image dengan custom field di Wordpress 2.7.1”

  1. Damn ! tadi lupa nanyain cara instalasi WP 2.7. di BLoG nok….

    Posted by PanDe Baik | May 6, 2009, 10:44 pm
  2. Wah terimakasih atas ilmunya, ini yang saya cari…

    Posted by Radi | June 14, 2009, 7:58 pm
  3. Terima Kasih banyak om noviar , berkat artikel ini, 19 jam ku hari ini tidak sia2.
    susah sekali abis ngubek2 Google selama 2 harian ternyata seperti ini caranya bikin thumbnail post

    Terima kasih sekali lagi

    gb

    Posted by Gobi | July 18, 2009, 8:44 pm
  4. siiplah, thanks banget and salam kenal :)

    Posted by azzaam | December 6, 2009, 1:26 pm

Post a comment