- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
インクルードタグ/comments template
提供: WordPress Codex 日本語版
このページ「インクルードタグ/comments template」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
タグ一覧: テンプレートタグ | インクルードタグ | 条件分岐タグ | その他の関数 | Code Reference
使い方: テンプレートタグ入門 | パラメータの渡し方 | 初心者の方へ | その他のテーマ関連資料
目次
説明
Loads the comment template. For use in single post and Page displays.
書き方
<?php comments_template( $file, $separate_comments ); ?>
パラメータ
- $file
- (string) (optional) The file to load
- 初期値: /comments.php
- $separate_comments
- (boolean) (optional) Whether to separate the comments by comment type.
- 初期値: false
用例
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
.
最新英語版: WordPress Codex » Function Reference/comments_template (最新版との差分)
関連項目
インクルードタグ: get_header(), get_footer(), get_sidebar(), get_template_part(), get_search_form(), comments_template()
関数リファレンス、テンプレートタグ目次もご覧ください。