سلام استاد.اینبار با مطالب مرتبط مشکل دارم.بدون افزونه میخوام مطالب رو نمایش بدم از کدهام هم هیچ اروری نمگیره اما مطالب هم رو نمایش نمیده.آیا مگه برای پیدا کردن مطالب مرتبط از برچسب ها استفاده نمیشه؟؟!! دو سه تا از پست هام داری یک برچسب هستند اما هیچ کدوم از اونها در مطالب مرتبط
نمایش داده نمیشن.
<?php
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$first_tag = $tags[0]->term_id;
$args=array(
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
'showposts'=>5,
'caller_get_posts'=>1
);
$rel_posts = new WP_Query($args);
if( $rel_posts->have_posts() ) {
while ($rel_posts->have_posts()) : $rel_posts->the_post(); ?>
<a href="<?php the_permalink(); ?>"><li>
<?php the_post_thumbnail(array(130,130)); ?>
<h5><?php the_title(); ?></h5>
<p><?php echo get_the_excerpt()?></p>
</li></a>
<?php
endwhile;
}
}
?>
مشکل کجاست؟