假设您位于分类法或术语页面上,那么您可以简单地使用:
//get current term
$term_slug = get_query_var( \'term\' );
//get current taxonomy
$taxonomyName = get_query_var( \'taxonomy\' );
$loop = new WP_Query( array(
\'post_type\' => \'work\',
\'posts_per_page\' => 10,
\'orderby\' => \'ASC\',
$taxonomyName => $term_slug);
while ( $loop->have_posts() ) : $loop->the_post();