自定义分类元素的 Wordpress 存档页面



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

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

如果您的分类客户端仅与客户端库帖子类型相关联,则 website.com/client/miller 应该足以显示此客户端的客户库列表。我在我的网站上测试了它,它可以工作。还是我弄错了什么?

最新更新