Menampilkan image dengan custom field di WordPress 2.7.1

March 25th, 2009 § 2,254 comments

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

Contoh:

hd film

despicable me move
buy scarface film on dvd

1a

screenshot from

fast five on dvd

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

watch braveheart full film good quality
watch harry potter and the deathly hallows: part 1 hd
the shining move
mars needs moms the movie to download
dvd season of the witch

  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

$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:

the clinic movie on dvd

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

watch no strings attached online

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

where can i buy sin city the film

<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>

<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

$key="the_excerpt_pict";

echo get_post_meta($post->ID, $key, true);

?>


<?php the_content('Read the rest of this entry &raquo;'); ?>

</div>

download the chronicles of narnia: the voyage of the dawn treader movies

<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; ?>

<?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.

download the king’s speech film in hd formats

11. Refresh halaman depan blog Anda untuk melihat hasilnya.

§ 2,254 Responses to Menampilkan image dengan custom field di WordPress 2.7.1"

  • When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks!

  • I harmonise with your conclusions and will-power thirstily look progressive to your coming updates.

  • Liebeszauber says:

    I wanted to construct a brief message to express gratitude to you for the superb tips and hints you are giving at this website. My extensive internet search has finally been paid with beneficial details to write about with my friends and classmates. I ‘d say that we readers are definitely fortunate to dwell in a decent website with so many awesome professionals with interesting basics. I feel very grateful to have come across the website page and look forward to plenty of more excellent times reading here. Thank you once again for a lot of things.

  • No-one likes spam, no-one will bother visiting you if you try and scream your website down their face so don’t do it. Simples.I hope these have helped you with your website! Feel free to comment below and give your own suggestions

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

What's this?

You are currently reading Menampilkan image dengan custom field di WordPress 2.7.1 at viar ms.

meta