如果您使用CPT,则应如下所示:
<?php
query_posts(array(
\'post_type\' => \'artists\',
\'showposts\' => 10,
\'tax_query\' => array(
array (
\'taxonomy\' => \'category_custom_post_type\', // <= Name of the taxonomy created type category for the CPT
\'field\' => \'slug\',
\'terms\' => \'news_category_slug\', // <= Slug taxonomy
)
),
) );
?>
<?php while (have_posts()) : the_post(); ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<p><?php echo get_the_excerpt(); ?></p>
<?php endwhile;
// reset the orignal query we should use this to reset wp_query
wp_reset_query(); ?>