2
我目前有一個CPT更改日誌,並且在我的自定義側欄上我想只顯示此CPT的檔案,而不是所有其他帖子。WordPress自定義帖子類型存檔窗口小部件只顯示CPT
例如:
2017年1 - >應只顯示CPT的changelog後 等。
這是我迄今爲止嘗試:
function custom_changelog_getarchives_where($where)
{
$where = str_replace("post_type = 'post'", "post_type IN ('post',
'changelog')", $where);
return $where;
}
add_filter('getarchives_where', 'custom_changelog_getarchives_where');
上面的代碼現在返回我的CPT的檔案,但它也有正常的崗位以及
我怎麼只顯示CPT?
'$ =哪裏str_replace(「post_type ='post'」,「post_type ='changelog'」,$ where);' – naththedeveloper