统计分类发表总数包含子分类数量。输出用
<?php echo CategoryAllCount($category->mid); ?>

//统计分类发表总数包含子分类数量。 输出用 echo CategoryAllCount($mid)
function CategoryAllCount($mid){
    $db = \Typecho\Db::get();
    $seclect = $db->fetchAll($db->select('table.metas.count')
        ->from('table.metas')
        ->where ('parent = ?', $mid)
        ->orWhere('mid = ? ', $mid)
    );
    $num = count($seclect);
    $Counts = 0;
    for ($i = 0; $i < $num; $i++) {
    $Counts = $seclect[$i]['count'] + $Counts;
    }
    return $Counts;
}