您可以检查分类服务。php当前查询的术语过滤器基于什么,如下所示:
//get the current term
$term_slug = get_query_var( \'term\' );
//get the current taxonomy
$taxonomyName = get_query_var( \'taxonomy\' );
//get the term object if you want
$current_term = get_term_by( \'slug\', $term_slug, $taxonomyName );
//then you can query your posts/custom based on that term
$s_query = NEW WP_Query(array(\'services\' => $term_slug, \'post_type\' => \'post\'));
//then you can simply filter the posts
if ($current_term->term_slug == "websites"){
while($s_query->have_posts){
$s_query->the_post();
//do websites loop
}
}elseif ($current_term->term_slug == "video"){
while($s_query->have_posts){
$s_query->the_post();
//do videos loop
}
}else{
while($s_query->have_posts){
$s_query->the_post();
//do any other loop of that taxonomy
}
}