- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
インクルードタグ/comments template
提供: WordPress Codex 日本語版
< インクルードタグ
2010年9月15日 (水) 20:34時点におけるBono (トーク | 投稿記録)による版 (en:Function Reference/comments_template 11:28, 15 September 2010 bono 版を翻訳用にコピー)
目次
Description
Loads the comment template. For use in single post and Page displays.
Usage
%%%<?php comments_template( $file, $separate_comments ); ?>%%%
Parameters
- $file
- (string) (optional) The file to load
- 初期値: /comments.php
- $separate_comments
- (boolean) (optional) Whether to separate the comments by comment type.
- 初期値: false
Examples
Alternative Comment Template
On some occasions you may want display your comments differently within your Theme. For this you would build an alternate file (ex. short-comments.php) and call it as follows:
<?php comments_template( '/short-comments.php' ); ?>
Notes
- Uses global: (array) $comment List of comment objects for the current post
- Uses: $wpdb
- Uses: $id
- Uses: $post
- Uses: $withcomments Will not try to get the comments if the post has none.
Changelog
Since: 1.5.0
Source File
comments_template() is located in wp-includes/comment-template.php
.
Related
インクルードタグ: get_header(), get_footer(), get_sidebar(), get_template_part(), get_search_form(), comments_template()
関数リファレンス、テンプレートタグ目次もご覧ください。
最新英語版: WordPress Codex » Function Reference/comments_template (最新版との差分)