來源于:
https://www.beizigen.com/839.html
WordPress模板標(biāo)簽comments_number用于輸出當(dāng)前文章的評論數(shù)量,必須用在The Loop主循環(huán)中。
comments_number( string $zero = false, string $one = false, string $more = false )
函數(shù)參數(shù)
$zero
字符串值,默認(rèn)值:No Comments
如果該文章沒有評論,則顯示$zero的值。
$one
字符串值,默認(rèn)值:1 Comment
如果該文章只有1條評論,則顯示$one的值。
$more
字符串值,默認(rèn)值:% Comments
如果該文章的評論數(shù)量大于1,則顯示$more的值,其中,% 表示評論的總數(shù)。
comments_number()函數(shù)使用示例
<p>
文章評論:
<?php comments_number('沒有評論', '1條評論', '%條評論'); ?>
</p>
擴(kuò)展閱讀
comments_number()函數(shù)函數(shù)位于:wp-includes/comment-template.php