Есть 3 типа записей (post, cooking, variety) Хочу чтобы в записях выводились другие записи сooking, variety по тегам.
function digatalart_tag_rel_post_title(){
global $post;
$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(
'post_type' => variety, cooking,
'tag__in' => $tag_ids,
'post__not_in' => array($post->ID),
'showposts'=>8, // Количество выводимых похожих записей.
'caller_get_posts'=>1
);
$my_query = new wp_query($args);
if($my_query->have_posts()){
echo '<div class="t-container" style="padding-top:20px;">';
while($my_query->have_posts()){
$my_query->the_post();
?>
<div class="t405__col t-col t-col_2 t-align_left"><a class="t405__link" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
<div class="t405__imgbox" >
<div class="t405__img" style="background-image: url('<?php
$thumb_id = get_post_thumbnail_id();
$thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
echo $thumb_url[0];
?>');"></div>
<div class="t405__separator"></div> </div>
<div class="t405__textwrapper">
<div class="t405__uptitle t-uptitle" style=""><span class="t405__tag"><?php the_category(',') ?></span></div>
<div class="t405__title t-name" style=""><?php the_title(); ?></div>
<div class="t405__descr t-descr" style=""><?php the_excerpt(); ?></div> </div>
</a>
</div></div>
<?php
}
echo '</div>';
}
else{
echo '';
}
wp_reset_postdata();
}
}
Но выводятся все записи с типа variety. Как сделать чтобы чисто по походим тегам выводились записи? неразобрался