GeekerCode更好的WordPress主题,值得信任的WordPress主题开发商

极美的主题、极致的插件

WordPress comments_template()调用评论模板函数

摘要:【函数介绍】comments_template()用于在文章页面(post)或者独立页面(page)调用指定的评论模板文件的函数。【函数使用】<?php comments_template( $file, $separate_

【函数介绍】

comments_template()用于在文章页面(post)或者独立页面(page)调用指定的评论模板文件的函数。

【函数使用】

<?php comments_template( $file, $separate_comments ); ?>

【参数说明】

$file

(string) (可选) 需要载入的模板文件名(位于主题目录下)

默认: /comments.php

$separate_comments

(boolean) (可选) 是否以评论类型来显示评论.

默认: false

【函数实例】

1、调用主题下的评论模板文件comments.php:

<?php comments_template(); ?> 

2、不同的文章类型去显示文章评论

<?php comments_template(get_post_format().'-comment.php', true ); ?>

建站!你有充足的理由选择我们

世界上超过30%的网站是由WordPress搭建,而我们是国内最靠谱的WordPress主题开发商
QQ咨询在线咨询问答互助微信号geekercode微信公众号云服务器