WordPress:Template Tags/comments popup link

来自站长百科
跳转至: 导航、​ 搜索

描述[ ]

如果使用comments_popup_script(),显示一个链接,连接到评论弹出窗口,否则,就显示一个普通的链接,连接到评论。必须在The Loop内部或者一个评论 loop内部使用这个标签,如果 is_single() or is_page()是正确的(即使是在The Loop内部),标签什么任务也不会执行。

用法[ ]

%%% <?php comments_popup_link ('zero','one','more','CSSclass','none'); ?> %%%

例子[ ]

对于评论数目,文本做出的反应[ ]

显示评论弹出窗口链接,对于零个评论,使用"还没有评论",对于一个评论,使用"我评论了","% 迄今有这麽多评论 (is that a lot?)" 对于不止一个评论 (% 由 #评论代替), "关于这篇文章的评论已经关闭了" 如果拥有评论,是不能发表的。此外,'评论-链接'是一个关于链接的自定义CSS class。

<p><?php comments_popup_link('No comments yet', '1 comment so far', 
'% comments so far (is that a lot?)', 'comments-link', '关于这篇文章的评论已经关闭了'); ?></p>

当评论已经被取消的时候,隐藏评论链接[ ]

隐藏段落元素<p></p&gt;当写>文章界面的评论功能取消了之后,<p></p&gt包含有comments_popup_link。对于那些想要一篇文章一篇文章地激活/取消评论的人的操作,有益。必须用在loop中。

<?php if ( comments_open() ) : ?>
<p>
<?php comments_popup_link( 'No comments yet', '1 comment', '% comments so far', 'comments-link', '关于这篇文章的评论功能关闭了'); ?>
</p>
<?php endif; ?>

参数[ ]

zero
(string) 没有评论的时候,显示的文本。 Defaults to 'No Comments'.
one
(string) 只有一个评论的时候,需要显示的文本。Defaults to '1 Comment'.
more
(string) 不止一个评论的时候,显示的文本。'%'被评论的数目所代替, 因此 ,当有五个评论的时候,'% so far' 显示为 "5 so far" 。默认 '% 评论'.
CSSclass
(string) 链接的CSS (样式表) 。没有默认值。
none
(string) 当取消评论的时候,显示的文本。默认'关闭评论'

相关的[ ]

comments_number, comments_link, comments_rss_link, comments_popup_script, comments_popup_link, comment_ID, comment_author, comment_author_IP, comment_author_email, comment_author_url, comment_author_email_link, comment_author_url_link, comment_author_link, comment_type, comment_text, comment_excerpt, comment_date, comment_time, comments_rss_link, comment_author_rss, comment_text_rss, comment_link_rss, permalink_comments_rss

模板:PHP 函数 标签 页底文字