我试图从类别ID"主题01"的帖子中提取缩略图。又名id 117和来自类别"成分"又名id 46.到目前为止,我得到了它的工作,但我想拉出符合"主题01"和"食谱"。还有符合"主题01"的帖子和#34;厨师"你明白了。我尝试在阵列中添加另一个类别ID,但没有运气。
<?php
$my_query_args = array('posts_per_page' => 6,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => array( 117, 46, 65 ),
'operator' => 'AND'
)
)
);
$my_query = new WP_Query( $my_query_args );
if( $my_query->have_posts() ) : while( $my_query->have_posts() ) : $my_query->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(46,65)); ?></a>
</li>
<?php endwhile; endif; wp_reset_postdata(); ?>