根据您的实际查询,这里有两种选择。如果您在WP default blog(Post)上查询$projects->have\\u posts(),您可以使用如下查询
$projects = new WP_Query( array( \'tag__in\' => array( 52, 53 ) ) );
另一种方法是,如果您正在查询自定义帖子类型,您可以使用以下查询来获取帖子或您想要的标签。
$array = array (
\'post_type\' => \'your custom post type\',
\'posts_per_page\' => 10,
// Your other criteria of the query
\'tax_query\' => array(
array(
\'taxonomy\' => \'name of your tag taxonomy\',
\'field\' => \'id\',
\'terms\' => array(52,53)
)
);
$projects = new WP_Query( $array );
if ( $projects->have_posts() ){
while ( $projects->have_posts() ) { $projects->the_post(); ?>
<div <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" class="thumb">
<?php the_post_thumbnail( $image_size ); ?>
<div class="portfolio-hover">
<div class="portfolio-description">
<h4><?php the_title(); ?></h4>
<div><?php the_excerpt(); ?></div>
</div>
</div>
</a>
</div>
<?php
}
}