Cara Membuat Related Post di Wordpress | TUGAS KAMPUS

Forum MT5 (1 Post = 0.2$ )

Cara Membuat Related Post di Wordpress

Menampilkan related post (artikel terkait) dibawah postingan merupakan cara yang sangat efektif agar pengunjung bisa mencari beberapa artikel yang berhubungan dengan apa yang sedang dibacanya. Selain itu, menampilkan related post juga bisa meningkatkan page views sebuah blog.

Sebagian blogger menggunakan beberapa plugin agar bisa menampilkan related post pada blognya, ternyata cara tersebut bisa memakan banyak resource pada server hostingan. Ada cara lain yang bisa digunakan untuk menampilkan related post (artikel terkait) pada wordpress yaitu menggunakan kode Php seperti yang zona-klik temukan pada Deka's Blog, untuk lebih jelasnya perhatikan langkah-langkah berikut :

1. Login pada account wordpress dengan username dan password pribadi.

2. Pada halaman dashbord account wordpress anda pilih "Appearance" lalu "Editor"

3. Pada halaman editor klik "Single Post (Single.php)"

4. Cari kode berikut pada single.php themes yang anda gunakan :

<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>

5. Copy lalu Paste kode berikut di bawah kode diatas

<?php
$this_post = $post;
$category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
$posts = get_posts('numberposts=6&offset=0&orderby=post_date&order=DESC&category='.$category);
$count = 0;
foreach ( $posts as $post )
{
if ( $post->ID == $this_post->ID || $count == 5) <!-- banyak related post yang ditampilkan -->
{
unset($posts[$count]);
}
else
{
$count ++;
}
}
?>
<?php if ( $posts ) : ?>
<div>
<strong>Related Posts</strong> <!-- Judul, bisa diganti -->
<ul>
<?php foreach ( $posts as $post ) : ?>
<li><a href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a></li>
<?php endforeach // $posts as $post ?>
</ul>
</div>
<?php endif // $posts ?>
<?php
$post = $this_post;
unset($this_post);
?>

Keterangan :
  • Jumlah related post yang ingin ditampilkan bisa dirubah sesuai dengan keinginan anda
  • Judul daripada related post bisa diganti, misalnya : related post diganti dengan artikel yang berhubungan, artikel terkait dan sebagainya.

6. Apabila kode tersebut benar-benar telah dimasukkan pada single.php themes anda dengan benar, pilih "update file" untuk menyimpan perubahan.

Klik "visit site" untuk melihat apakah related post (artikel terkait) telah tampil pasa postingan blog anda. Biasanya related post akan muncul sesuai dengan kategori masing-masing artikel, pastikan setiap kategori artikel blog anda memiliki lebih dari satu untuk menampilkan related post tersebut.

Posted: 27 Mar 2010 06:44 PM PDT
Have you visited the site behappy2day.com? if yet I will try explain to you about site and what usefulness. BeHappy is multinationals headquartered in Tver, Russia. These are companies that provide dating services for men all over the world who want to meet with Russian Brides woman who stood in 2000 a successful year with 24 offices throughout the former Uni Soviet and the United States. They have clients qualified to given to subscribers so makes them becomes place very popular for women who want meet male various world.

BeHappyday.com gained trust and dependable by companies International Romance Tour who connecting people western beautifully Russian Brides from town Tver and secondhand USSR which provide services to clients with services letter. To the women who wanted join our site can register herself free and could insert photo and profilenya with biografical information.

Related Posts



2 komentar:

denny on March 1, 2011 at 7:22 AM said...

MAksih infonya gan,,,,,,


di tunggu aksi berikutnya,,,,,

denny on March 1, 2011 at 7:28 AM said...

infonya bagus gan,,,,,,


ditunggu yang berikute..........

Cari Skripsi | Artikel | Makalah | Panduan Bisnis Internet Disini

Custom Search
 

Mybloglog

blogcatalog

Alphainventions.com

Followers

TUGAS KAMPUS Copyright © 2009 Blogger Template Designed by Bie Blogger Template