描述
加載評論模板。只能用于單篇 文章 或 頁面 來顯示評論,如果不是這些頁面,將沒辦法顯示。
用法
<?php comments_template( $file, $separate_comments ); ?>
參數(shù)
- $file
- (字符串string) (可選) 要加載的文件
- 默認(rèn): /comments.php
- $separate_comments
- (布爾值boolean) (可選) 是否根據(jù)評論的類型劃分評論
- 默認(rèn): false
例子
默認(rèn)用法
<?php comments_template(); ?>
另類的評論模板
在某些情況下,你希望以不同的方式來顯示你的評論,那么,你可以建立一個自定義的文件(例如 short-comments.php),并且通過下面的方式調(diào)用:
<?php comments_template( '/short-comments.php' ); ?>
注釋
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.
所在文件
comments_template() 包含在 wp-includes/comment-template.php.
可用過濾器和動作
List of comment filters and actions
相關(guān)函數(shù)
comment_form()
get_header(), get_footer(), get_sidebar(), get_template_part(), get_search_form()
聲明:本站所有文章,如無特殊說明或標(biāo)注,均為本站原創(chuàng)發(fā)布。任何個人或組織,在未征得本站同意時,禁止復(fù)制、盜用、采集、發(fā)布本站內(nèi)容到任何網(wǎng)站、書籍等各類媒體平臺。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進(jìn)行處理。





這評論是自帶的嗎?就是改了樣式?我都不知道comments.php要寫點(diǎn)什么鬼
請問如何才能前臺顯示評論,然后能夠刪除評論的
測試代碼樣式
(function() {"use strict";
function inject(str)
{
var elem = document.createElement("script");
elem.setAttribute("type", "application/javascript");
elem.textContent = "(function() {\"use strict\"; (" + str + ")();})();";
document.body.appendChild(elem);
}
小白表示只看懂了一點(diǎn)點(diǎn)。
測試,兩個字不能發(fā)送?