comments_popup_link – WordPress テンプレートタグのリファレンス
comments_popup_script()が使用される場合、コメントポップアップウィンドウでリンクを表示します。それ以外の場合はコメントを通常のリンクで表示します。このタグは、ループ内、またはコメントループ内でなければならず、is_single()かis_page()がtrueである場合にはなにもしません(ループ内の場合でさえ)。
Displays a link to the comments popup window if comments_popup_script() is used, otherwise it displays a normal link to comments. This tag must be within The Loop, or a comment loop, and it does nothing if is_single() or is_page() is true (even when within The Loop).
comments_popup_linkのテンプレートタグ使用方法
<?php comments_popup_link
('zero','one','more','CSSclass','none');
?>
例
コメント数に応答するテキストです
コメントポップアップリンクを表示します。コメントがない場合に”No comments yet”を、1つの場合に”1 comment so far”、1つ以上の場合(% replaced by # of comments)に”% comments so far (is that a lot?)”、コメントが動作していない場合は”Comments are off for this post”を使用します。
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, ‘comments-link’ is a custom CSS class for the link.
<p><?php comments_popup_link('No comments yet', '1 comment so far',
'% comments so far (is that a lot?)', 'comments-link', 'Comments are
off for this post'); ?></p>
コメントが非アクティブの時、コメントリンクを非表示する場合
投稿画面。記事によってコメント投稿を表示/日表示にしたい場合によい。ループ内で使用する必要があります。
Hides the paragraph element <p></p> that contains the comments_popup_link when comments are deactivated in the Write>Post screen. Good for those who want enable/disable comments post by post. Must be used in the loop.
<?php if ( comments_open() ) : ?> <p> <?php comments_popup_link( 'No comments yet', '1 comment', '% comments so far', 'comments-link', 'Comments are off for this post'); ?> </p> <?php endif; ?>
comments_popup_linkのパラメーター
zero
(string) コメントがない場合に表示するテキストです。デフォルトは’No Comments’です。
(string) Text to display when there are no comments. Defaults to ‘No Comments’.
one
(string) 1つのコメントがある場合に表示するテキストです。 デフォルトは’1 Comment’です。
(string) Text to display when there is one comment. Defaults to ’1 Comment’.
more
(string) 1つ以上のコメントがある場合に表示するテキストです。’%'はコメント数に置き換えられるので、コメントが5つある時の’% so far’は”5 so far”として表示されます。デフォルトは’% Comments’です。
(string) Text to display when there are more than one comments. ‘%’ is replaced by the number of comments, so ‘% so far’ is displayed as “5 so far” when there are five comments. Defaults to ‘% Comments’.
CSSclass
(string) のリンクのためのCSS (stylesheet) クラスです。これはデフォルの値がありません。
(string) CSS (stylesheet) class for the link. This has no default value.
none
(string) コメントが向こうの時に表示するテキストです。デフォルトは’Comments Off’です。
(string) Text to display when comments are disabled. Defaults to ‘Comments Off’.
関連テンプレートタグ
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, comment_author_rss, comment_text_rss, permalink_comments_rss, wp_list_comments, comment_reply_link, cancel_comment_reply_link, comment_form_title, comment_id_fields, previous_comments_link, next_comments_link, paginate_comments_links
Tags:WordPress コメントタグ テンプレートタグ リファレンス
ツイート