$args = array( 'post_type' => 'product', 'posts_per_page' => 10, 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'slug', //可以根据其他字段如id或name等来搜索 'terms' => 'vendor-slug', //将vendor-slug替换为供应商的分类别名 ), ), ); $products = new WP_Query( $args );
echo '
' . get_the_title() . ' | '; //获取产品标题 echo '' . get_post_meta( get_the_ID(), '_price', true ) . ' | '; //获取产品价格 echo '
上一篇:按类别显示的自定义文章类型