[英]pods: Query customs posts filter by custom taxonomy
使用莢,我創建了一個新的自定義后類型命名staff_member
其中包含一個字段 staff_department_relationship
是關系到一個自定義分類類型的關系 staff_department
。 還要注意, staff_department_relationship
字段是格式 dropdown
的single select
。
現在,我想查詢來自某個特定部門的所有工作人員,並按照http://pods.io/docs/code/pods/find/嘗試了很多不同的方法,但沒有成功。 有時我會收到數據庫錯誤或根本沒有帖子:
$params = array(
'limit' => -1,
// 'where' => 'staff_department_relationship.staff_department = "some_custom_taxonomy_slug"'
'where' => 'staff_department.name = "some_custom_taxonomy_slug"'
);
$pods = pods('staff_member', $params);
有人知道發生了什么嗎?
定義塊,而不是名稱“ where” =>“ staff_department”。 slug =“ some_custom_taxonomy_slug”'
分類的代碼列表post_type-PODS Wordpress
<?php
$params = array(
'limit' => -1,
'where'=>"TaxonomySlug.Slug = 'TaxonomyTermSlug'" ,
);
$pods = pods( 'NamePostypeHere' )->find( $params );
if ( $pods->total() > 0 ) {
while( $pods->fetch() ) {
//reset id
$pods->id = $pods->id();
//get the template
$temp = $pods->template( 'NameTemplateHere' );
//output template if it exists
if ( isset( $temp ) ) { ?>
<?php echo $temp; ?>
<?php }
}
//pagination
echo $pods->pagination();
}
else { echo 'No content found.'; }
?>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.