WordPress: Template Tags/comments popup link:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
无编辑摘要
无编辑摘要
 
第1行: 第1行:
== Description ==
== 描述 ==
== 描述 ==


Displays a link to the comments popup window if [[WordPress:Template_Tags/comments_popup_script|comments_popup_script()]] is used, otherwise it displays a normal link to comments. This tag must be within [[WordPress:The Loop]], or a comment loop, and it does nothing if [[WordPress:Conditional_Tags#A_Single_Post_Page | is_single()]] or [[WordPress:Conditional_Tags#A_PAGE_Page | is_page()]] is true (even when within [[WordPress:The Loop]]).
如果使用[[WordPress:Template_Tags/comments_popup_script|comments_popup_script()]],显示一个链接,连接到评论弹出窗口,否则,就显示一个普通的链接,连接到评论。必须在[[WordPress:The Loop|The Loop]]内部或者一个评论 loop内部使用这个标签,如果[[WordPress:Conditional_Tags#A_Single_Post_Page | is_single()]] or [[WordPress:Conditional_Tags#A_PAGE_Page | is_page()]]是正确的(即使是在[[WordPress:The Loop|The Loop]]内部),标签什么任务也不会执行。
 
如果使用[[WordPress:Template_Tags/comments_popup_script|评论_弹出_脚本()]],显示一个链接,连接到评论弹出窗口,否则,就显示一个普通的链接,连接到评论。必须在[[WordPress:The Loop|The Loop]]内部或者一个评论 loop内部使用这个标签,如果[[WordPress:Conditional_Tags#A_Single_Post_Page | is_single()]] or [[WordPress:Conditional_Tags#A_PAGE_Page | is_page()]]是正确的(即使是在[[WordPress:The Loop|The Loop]]内部),标签什么任务也不会执行。
 
== Usage ==


== 用法 ==
== 用法 ==
第14行: 第8行:
('zero','one','more','CSSclass','none');
('zero','one','more','CSSclass','none');
?> %%%
?> %%%
%%% <?php comments_popup_link
('zero','one','more','CSSclass','none');
?> %%%
== Examples ==


== 例子 ==
== 例子 ==


===Text Response for Number of Comments===
===对于评论数目,文本做出的反应===  
 
===对于评论数目,文本做出的反应===
 
Displays the comments popup link, using "No comments yet" for no comments, "1 comment so far" for one, "% comments so far (is that a lot?)" for more than one (% replaced by # of comments), and "Comments are off for this post" if commenting is disabled. Additionally, <tt>'comments-link'</tt> is a custom [[WordPress:Glossary#CSS|CSS]] class for the link.


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


  &lt;p&gt;<?php comments_popup_link('No comments yet', '1 comment so far',  
  &lt;p&gt;<?php comments_popup_link('No comments yet', '1 comment so far',  
  '% comments so far (is that a lot?)', 'comments-link', 'Comments are
  '% comments so far (is that a lot?)', 'comments-link', '关于这篇文章的评论已经关闭了'); ?>&lt;/p&gt;
off for this post'); ?>&lt;/p&gt;
 
&lt;p&gt;<?php 评论_弹出_链接('还没有评论', '我发表了评论',
'%评论(很多吗?)', '评论-链接', '关于这篇文章的评论已经关闭了'); ?>&lt;/p&gt;
 
===Hide Comment Link When Comments Are Deactivated===


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


Hides the paragraph element &lt;p&gt;&lt;/p&gt; that contains the comments_popup_link when comments are deactivated in the Write&gt;Post screen. Good for those who want enable/disable comments post by post. Must be used in the loop.
隐藏段落元素&lt;p&gt;&lt;/p&gt;当写&gt;文章界面的评论功能取消了之后,&lt;p&gt;&lt;/p&gt包含有comments_popup_link。对于那些想要一篇文章一篇文章地激活/取消评论的人的操作,有益。必须用在loop中。


隐藏段落元素&lt;p&gt;&lt;/p&gt;当写&gt;文章界面的评论功能取消了之后,&lt;p&gt;&lt;/p&gt包含有评论_弹出_链接。对于那些想要一篇文章一篇文章地激活/取消评论的人的操作,有益。必须用在loop中。
<?php if ( comments_open() ) : ?><br />&lt;p&gt;<br /><?php comments_popup_link( 'No comments yet', '1 comment', '% comments so far', 'comments-link', '关于这篇文章的评论功能关闭了'); ?><br />&lt;/p&gt;<br /><?php endif; ?>
 
<?php if ( comments_open() ) : ?><br />&lt;p&gt;<br /><?php comments_popup_link( 'No comments yet', '1 comment', '% comments so far', 'comments-link', 'Comments are off for this post'); ?><br />&lt;/p&gt;<br /><?php endif; ?>
 
<?php if ( comments_open() ) : ?><br />&lt;p&gt;<br /><?php comments_popup_link( '还没有评论', '1 个评论', '% comments so far', 'comments-link', '关于这篇文章的评论功能关闭了'); ?><br />&lt;/p&gt;<br /><?php endif; ?>
 
== Parameters ==


== 参数 ==
== 参数 ==


; zero : (''string'') Text to display when there are no comments. Defaults to <tt>'No Comments'</tt>.
; zero : (''string'') 没有评论的时候,显示的文本。 Defaults to <tt>'No Comments'</tt>.
; one : (''string'') Text to display when there is one comment. Defaults to <tt>'1 Comment'</tt>.
; one : (''string'') 只有一个评论的时候,需要显示的文本。Defaults to <tt>'1 Comment'</tt>.
; more : (''string'') Text to display when there are more than one comments. <tt>'%'</tt> is replaced by the number of comments, so <tt>'% so far'</tt> is displayed as "5 so far" when there are five comments. Defaults to <tt>'% Comments'</tt>.
; more : (''string'') 不止一个评论的时候,显示的文本。<tt>'%'</tt>被评论的数目所代替, 因此 ,当有五个评论的时候,<tt>'% so far'</tt> 显示为 "5 so far" 。默认 <tt>'% 评论'</tt>.
; CSSclass : (''string'') CSS (stylesheet) class for the link. This has no default value.
; none : (''string'') Text to display when comments are disabled. Defaults to <tt>'Comments Off'</tt>.
 
 
 
 
 
; 零 : (''string'') 没有评论的时候,显示的文本。默认<tt>'没有评论'</tt>。
; 一个 : (''string'') 只有一个评论的时候,需要显示的文本。默认<tt>'1个评论'</tt>。
; 更多的 : (''string'') 不止一个评论的时候,显示的文本。<tt>'%'</tt>被评论的数目所代替, 因此 ,当有五个评论的时候,<tt>'% so far'</tt> 显示为 "5 so far" 。默认 <tt>'% 评论
'</tt>.
; CSSclass : (''string'') 链接的CSS (样式表) 。没有默认值。
; CSSclass : (''string'') 链接的CSS (样式表) 。没有默认值。
; 没有 : (''string'') 当取消评论的时候,显示的文本。默认<tt>'关闭评论'</tt>。
; none : (''string'') 当取消评论的时候,显示的文本。默认<tt>'关闭评论'</tt>。
 
== Related ==
 
{{Tag Comments Tags}}
 
{{PHP Function Tag Footer}}


== 相关的 ==
== 相关的 ==

2008年7月11日 (五) 11:57的最新版本

描述[ ]

如果使用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 函数 标签 页底文字