WordPress: Etiketler İlgili Yayınlar, ama aynı Kategoriler

0 Cevap php

Ben etiketleri ile ilgili mesajları almak için aşağıdaki komut dosyası kullanarak, ama ben white etiketli bir kuş resim var ve bir tablo da white etiketli ise, tablo gösterecektir fark ediyorum kuşun ilgili mesajlar bölümüne kadar. Sadece kategorilerin en az birini maç mesajları almak için bir yolu var mı, bu yüzden onlar bir kategori paylaşmak sürece kuş ve masa, ilgili olmayacak?

Ben $ args içinde bir category__in dizisini ayarlayarak çalıştı, ama hayır şans!

<?php
  $tags = wp_get_post_tags($post->ID);
  if ($tags) {
$tag_ids = array();
foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;

$args=array(
    'tag__in' => $tag_ids,
    'post__not_in' => array($post->ID),
    'showposts'=>6, // Number of related posts that will be shown.
    'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if( $my_query->have_posts() ) {
    while ($my_query->have_posts()) {
        $my_query->the_post();
    ?>

    <?php if ( get_post_meta($post->ID, 'Image', true) ) { ?>
        <a style="text-decoration: none;" href="<?php the_permalink(); ?>">
            <img style="max-height: 125px; margin: 15px 10px; vertical-align: middle;" src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "Image", $single = true); ?>&w=125&zc=1" alt="" />
        </a>
    <?php } ?>      

    <?php
    }
}
  }
?>

0 Cevap