Wednesday, October 6th 2021.
[insert_php]
<h4>artikel Terkait :</h4>
<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>
<?php Foreach ( $posts As $post ) : ?>
<a Href="<?php The_permalink() ?>" Target="_blank"><?php If ( Get_the_title() ){ The_title(); } Else { Echo "tidak Ada Artikel Terkait"; } ?></a><br>
<?php Endforeach // $posts As $post ?>
</div>
</div>
<?php Endif // $posts ?>
<?php $post = $this_post;unset($this_post);?>
[/insert_php] 
