Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress拉入共享同一类别的多个帖子_Php_Wordpress - Fatal编程技术网

Php Wordpress拉入共享同一类别的多个帖子

Php Wordpress拉入共享同一类别的多个帖子,php,wordpress,Php,Wordpress,我试着从分类id“Theme 01”又名ID117和分类id为“配料”又名ID46的帖子中提取缩略图。到目前为止,我得到了它的工作,但我也想拉在帖子匹配“主题01”和“食谱”。还张贴了与“主题01”和“厨师”等相匹配的帖子。你明白了。我尝试向数组中添加另一个类别id,但没有成功 <?php $my_query_args = array('posts_per_page' => 6, 'tax_query' => array( array(

我试着从分类id“Theme 01”又名ID117和分类id为“配料”又名ID46的帖子中提取缩略图。到目前为止,我得到了它的工作,但我也想拉在帖子匹配“主题01”和“食谱”。还张贴了与“主题01”和“厨师”等相匹配的帖子。你明白了。我尝试向数组中添加另一个类别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(); ?>