我在我的主题的短代码中有这样的代码来显示这样的特色产品评级产品。但我需要按类别展示产品。我必须添加哪个代码。有什么建议吗?
if($type == \'featured\'){
/**********QUERY FOR FEATURED PRODUCT**********/
$query_args = array(\'posts_per_page\' => $number, \'no_found_rows\' => 1, \'post_status\' => \'publish\', \'post_type\' => \'product\' );
$query_args[\'meta_query\'] = array();
$query_args[\'meta_query\'][] = array(
\'key\' => \'_featured\',
\'value\' => \'yes\'
);
$query_args[\'meta_query\'][] = $woocommerce->query->stock_status_meta_query();
$query_args[\'meta_query\'][] = $woocommerce->query->visibility_meta_query();
/**********END QUERY FOR FEATURED PRODUCT**********/
}elseif($type == \'top-rated\'){
/**********QUERY FOR TOP-RATED PRODUCT**********/
add_filter( \'posts_clauses\', array( $woocommerce->query, \'order_by_rating_post_clauses\' ) );
$query_args = array(\'posts_per_page\' => $number, \'no_found_rows\' => 1, \'post_status\' => \'publish\', \'post_type\' => \'product\' );
$query_args[\'meta_query\'] = array();
$query_args[\'meta_query\'][] = $woocommerce->query->stock_status_meta_query();
$query_args[\'meta_query\'][] = $woocommerce->query->visibility_meta_query();
/**********END QUERY FOR TOP-RATED PRODUCT**********/