V.I.P FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.
HELLO, Visitor

Cara Membuat Artikel Terkait Wordpress

Go down

Cara Membuat Artikel Terkait Wordpress Empty Cara Membuat Artikel Terkait Wordpress

Post by RodDick Fri Oct 14, 2011 2:35 pm

anyak bloger sudah menulis artikel tentang cara membuat artikel terkait wordpress, namun blog Belajar Komputer ini juga menulis artikel yang sama supaya membantu pengunjung blog Ilmu KOmputer Gratis ini. Artikel terkait yang dimaksud adalah artikel yang selalu muncul di bagian bawah dari artikel yang diposting. Dengan memasang artikel terkait di bagian akhir suatu tulisan membuat blog kita semakin mudah dijelajahi oleh pengunjung karena dapat dengan mudah menemukan artikel lain selain artikel yang ditemukan dari search engine.

Artikel terkait biasa dikenal dengan sebutan related post ini sendiri berfungsi untuk menghubungkan setiap artikel yang satu dengan artikel lainnya yang saling berkaitan.

Berikut ini cara membuat artikel terkait wordpress (hosting sendiri).

Login ke wordpress anda kemudian klik Menu Appearance dan klik sub menu Editor.


Klik pada single post (single.php) dan temukan dulu kode berikut

<div class="content">
<?php the_content(); ?>
<div class="fixed"></div>
</div>

Setelah ketemu kode di atas maka copy kode berikut ini,

<!-- related posts START -->
<?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) {
unset($posts[$count]);
}else{
$count ++;
}
}
?>
<?php if ( $posts ) : ?>
<div>
<h2>Artikel Terkait</h2>
<ol>
<?php foreach ( $posts as $post ) : ?>
<li><a href="<?php the_permalink() ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a></li>
<?php endforeach // $posts as $post ?>
</ol>
</div>
<?php endif // $posts ?>
<?php
$post = $this_post;
unset($this_post);
?>
<!-- related posts END -->


Dan paste kode yang barusan di copy tepat di bawah kode <?php the_content(); ?> tadi.

Menurut pengalaman saya saat membuat artikel terkait di blog saya yang lain dengan template Twenty Ten, saya tidak menemukan kode <?php the_content(); ?> apabila anda juga tidak menemukan kode tersebut coba ikuti cara berikut ini.

Cari kode seperti berikut,

<div id="container">
<div id="content" role="main">
...
</div><!-- #content -->
</div><!-- #container -->


Kalau sudah ketemu kode yang di cari di atas maka pastekan kode related post tepat di bawah kode </div><!-- #container -->

Cara membuat artikel terkait wordpress anda sudah selesai namun untuk template Twenty Ten, tampilan artikel terkait berada di bawah kotak komentar.

semoga bermanfaat... nice inpo
RodDick
RodDick
Calon Penduduk Cyber
Calon Penduduk Cyber

Capricorn

Jumlah posting : 92
Points : 4807
Reputation : 3
Join date : 10.10.11
Age : 33
Lokasi : Malang

Kembali Ke Atas Go down

Kembali Ke Atas

- Similar topics

 
Permissions in this forum:
Anda tidak dapat menjawab topik