<?php
$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'=>3, // Gösterilecek benzer yazı sayısı
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
echo '<ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<li>
<div class="ribbon"><div class="icon-<?php the_category_ID(); ?>"></div></div>
<div class="category"><?php $category = get_the_category(); echo '<a href="'.get_category_link($category[0]->term_id ).'" title="'.$category[0]->cat_name.'">'.$category[0]->cat_name.'</a>'; ?></div>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><img src="<?php if (has_post_thumbnail()) { $resimyolu = wp_get_attachment_image_src(get_post_thumbnail_id(), 'newsblok'); echo $resimyolu[0]; } ?>" alt="#" width="263" height="250"/></a>
<div class="details">
<h4><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
<div class="subinfo">
<div class="date"><div class="icon-clock"></div><?php echo human_time(); ?></div>
<div class="author"><div class="icon-user"></div><?php the_author(); ?></div>
</div>
<p><?php wpn_content_limit(get_the_content(),114); ?><a href="<?php the_permalink() ?>" title="Devamını Oku">Devamını Oku</a></p>
<div class="btn small icon bg red cb dn"><?php $category = get_the_category(); echo '<a href="'.get_category_link($category[0]->term_id ).'" title="'.$category[0]->cat_name.'">'.$category[0]->cat_name.'</a>'; ?><div class="icon-right-thin"></div></div>
</div>
</li>
<?php
}
echo '</ul>';
}
wp_reset_query();
}
?>