GRATIS Panduan ECourse Cara Membuat Landing Page 2023 bersama Agungnesia Klik Disini

Cara related post berdasarkan tag wordpress

Cara memasang related post berdasarkan tag pada blog wordpress tanpa plugin alias edit di folder cpanel anda.
caranya yaitu
1. Masuk cpanel
2. pilih tema anda
3. cari single .php lalu edit
4. cari / control + f tulisan atau kode ini : <?php the_content('Read the rest of this entry'); ?> dan pastekan kode dibawah ini kode kode dibawah kode tersebut.
<h3>Related Post :</h3>
<div class="relatedpost">
<?php $this_post = $post;$category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;$posts = get_posts('numberposts=5&offset=0&orderby=rand&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>
<ol>
<?php foreach ( $posts as $post ) : ?>
<li><a href="<?php the_permalink() ?>" target="_blank"><?php if ( get_the_title() ){ the_title(); } else { echo "No Related Post"; } ?></a></li>
<?php endforeach // $posts as $post ?>
</ol>
</div>
</div>
<?php endif // $posts ?>
<?php $post = $this_post;unset($this_post);?>
5. klik simpan beres dech
Sumber : http://info-menarik.net/cara-membuat-related-post-tanpa-plugin-di-wordpress/comment-page-2/#comment-1890

1 komentar untuk "Cara related post berdasarkan tag wordpress"

Terimakasih telah berkunjung, silahkan tinggalkan komentar