Ben bu kodla ilgili yazının altına benzer taxonomiye sahip yazıları listedim.
Bununla çalışarak bir yere varabilirsin.
<?php
//for in the loop, display all "content", regardless of post_type,
//that have the same custom taxonomy (e.g. genre) terms as the current post
$found_none = '<h4>Benzer İlan bulunamadı!</h4>';
$taxonomy = 'mahalle';// e.g. post_tag, category, custom taxonomy
$param_type = 'mahalle'; // e.g. tag__in, category__in, but genre__in will NOT work
$tax_args=array('orderby' => 'date');
$tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args);
if ($tags) {
foreach ($tags as $tag) {
$args=array(
$param_type => $tag->slug,
'post__not_in' => array($post->ID),
'post_type' => 'ilanlar',
'showposts'=> 4,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="four columns listing">
<div class="post-container short">
<?php echo get_the_term_list( $post->ID, 'tip', '<span> ', ', ', '</span>' ); ?>
<?php echo has_post_thumbnail() ? my_get_image() : my_get_image_blank();?>
<h5><a href="<?php the_permalink();?>"><?php the_title();?> </a></h5>
<a class="small button" href="<?php the_permalink();?>">→</a></p>
</div>
</div>
<?php $found_none = '';
endwhile;
}
}
}
if ($found_none) {
echo $found_none;
}
wp_reset_query(); // to use the original query again
?>