<?php
// 將以下 8 改成你的分類 ID 即可

echo get_category(8)->count;

?>

在制作wordpress模板時,有時會需要調用某個分類目錄下的所有內容數量,通過這段簡潔的代碼就可以實現。