如何向 WordPress 主题添加评论

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12134183/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:59:39  来源:igfitidea点击:

How to add comments to a WordPress theme

wordpresswordpress-theming

提问by RyanJP

How can I add comments to my WordPress theme. I tried <?php comment_form(); ?>but it doesn't give any output. Am I missing something?

如何向我的 WordPress 主题添加评论。我试过了,<?php comment_form(); ?>但它没有给出任何输出。我错过了什么吗?

回答by The Alpha

Just add the following line

只需添加以下行

<?php comments_template(); ?>

inside your single.phpwhere you want to add/display the comments template. This will add/include the comments.phpfile in the singletemplate and make sure that comments.phpis also available in your theme folder.

在您single.php要添加/显示评论模板的位置。这将comments.phpsingle模板中添加/包含该文件,并确保该comments.php文件也在您的主题文件夹中可用。

Also you can use Disquswordpress plugin, it's a very nice plugin.

你也可以使用Disquswordpress 插件,这是一个非常好的插件。

References:Codexand a tutorial.

参考资料:Codex教程