在这一行中,您只获得已发布项目的计数(obviously!!!!):
$published_projects = $count_projects->publish;
您应该这样做:
$count_projects = wp_count_posts( \'apps\' );
$published_projects = $count_projects->publish;
$draft_projects = $count_projects->draft;
$total = $published_projects + $draft_projects;
更多详细信息和示例,请参见
wp_count_posts()
参考