Konunun ilk sayfasında düzenleme yaptım ilk sayfadaki kodları kullanabilirsiniz

Aklıma bir fikir geldi hemen uyguladım sonuç süper daha önce neden denemedim anlamış değilim neyse fazla uzatmayayım

Şimdi sistem yazıdaki etiketlere göre benzer yazıları listeliyordu bence en mantıklı yüntem bu ama etiketler uyuşmadığında ya da benzer yazılarda etiket yoksa kod içindeki uyarı mesajı görünüyordu

Benzer yazı bulunamadı !

işte bu uyarının olduğu bölüme yazının kategorilerinin bulunduğu diğer yazıları listeleyecek bir kod ekledim bu sayede yazı bulanamadı yerine yazının kategorisindeki diğer yazılar göründü

Aslında bu kodu etiketlere göre gösterim yapan koddan önce benzer yazılar için kullanıyordum iki sistem birleşince Süper resimli benzer yazılar ortaya çıkıyor


Yapılacak olan değişiklik;


Kod içindeki <h3>Benzer yazı bulunamadı !</h3> bölümünü siliyoruz ve aşağıdaki kodları ekliyoruz

<?php
$this_post = $post;
$category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
$posts = get_posts('numberposts=4&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 ) : ?>
<ul>
<?php function getWords($text, $limit) {
$array = explode(" ", $text, $limit +1);
if(count($array) > $limit) {
unset($array[$limit]);
}
return implode(" ", $array); }
?>
<?php foreach ( $posts as $post ) : ?>
<?php $mycontent = strip_tags($post->post_content);
$excerpt = getWords($mycontent, 15);
$a_title = $excerpt . "..."; ?>
<li><a href="<?php the_permalink(); ?>" title="<?php echo $a_title ?>">
<?php if ( get_the_title() ) { the_title(); } else { echo "Untitle"; } ?></a>
<?php endforeach // $posts as $post ?>
</ul>
<?php endif // $posts ?>
<?php
$post = $this_post;
unset($this_post);
?>

Yukarıdaki kod ile yazılar resimli görünmez bağlantı olarak görünür sadece yapılan değişiklik hakkında bilgi vermek için yazdım resimli olarak düzenlenen kod konunun ilk sayfasında