我有一个自定义帖子类型clientgallery
和自定义分类法client
。
要获取所有画廊,我可以输入 website.com/clientgallery。
但我只想显示特定客户的画廊,例如:website.com/clientgallery/miller
所以,miller
应该像一个 get 参数。
我已经知道如何通过客户端获取画廊,但我不知道如何让参数部分正常工作。
$args = array(
'numberposts' => -1, //limit the number of posts, set 0 if no limit required.
'orderby' => 'post_date', //order by post_date field.
'order' => 'DESC', //order by descending oder.
'post_type' => 'clientgallery', //the post type is custom post type 'News & Events'
'post_status' => 'publish', //post status is 'publish'
'tax_query' => array(
array(
'taxonomy' => 'client', //custom taxonomy slug
'field' => 'slug', //select taxonomy term by slug
'terms' => $_GET['client'] //taxonomy term is called 'home-page'
)
));