WordPress弹出评论链接标签:comments_popup_link

WordPress模板标签comments_popup_link用于输出弹出评论的链接,当使用了comments_popup_script()函数时,点击该链接可实现弹出窗口评论,如果没有使用comments_popup_script()函数,则输出普通的跳转到评论区域的链接。

由于comments_popup_script()函数在WordPress 4.5版本已弃用,所以comments_popup_link()也变得没有意义。

comments_popup_link( string $zero = false, string $one = false, string $more = false, string $css_class = '', string $none = false )

函数参数

$zero

字符串值,默认值:No Comments

没有评论时显示的内容。

$one

字符串值,默认值:1 Comment

只有一条评论时显示的内容。

$more

字符串值,默认值:% Comments

大于一条评论时显示的内容。

$css_class

字符串值,默认值为空

链接的class类名称

$none

字符串值,默认值:Comments Off

评论关闭时显示的内容

函数使用示例

<p>
<?php
	comments_popup_link( '没有评论', '1条评论', '%条评论', 'comments-link', '当前文章不允许评论');
?>
</p>

扩展阅读

comments_popup_link()函数位于:wp-includes/comment-template.php

相关函数:

阿里云