0

我有一个自定义帖子类型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'
    )
));
4

2 回答 2

2

称之为taxonomy-client.php:在此处查看有关WordPress模板层次结构的所有信息:http: //codex.wordpress.org/images/1/18/Template_Hierarchy.png

于 2012-11-20T15:20:44.633 回答
1

如果您的分类客户仅与 clientgallery 帖子类型相关联,那么 website.com/client/miller 应该足以显示该客户的客户画廊列表。我在我的网站上测试过,它有效。还是我有什么问题?

于 2012-11-19T20:51:20.983 回答