Merhaba arkadaşlar internette birçok yazıyı okudum fakat verilen kodların çoğu hatalı ve çalışmıyor.Eklenti olarak bu mevcut fakat eklentisiz yani php kodları lazım çünkü düzenlemeler yapmam gerekiyor.
Yardımcı olursanız sevinirim teşekkürler.
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'showposts'=>5, // Gösterilecek benzer yazı sayısı
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo 'Benzer yazılar
';
}
wp_reset_query();
}
?>
.relatedposts {width: 640px; margin: 0 0 20px 0; float: left; font-size: 12px;}
.relatedposts h3 {font-size: 20px; margin: 0 0 5px 0; }
.relatedthumb {margin: 0 1px 0 1px; float: left; }
.relatedthumb img {margin: 0 0 3px 0; padding: 0;}
.relatedthumb a {color :#333; text-decoration: none; display:block; padding: 4px; width: 150px;}
.relatedthumb a:hover {background-color: #ddd; color: #000;}