如何向 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
How to add comments to a WordPress theme
提问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.php
where you want to add/display the comments template. This will add/include the comments.php
file in the single
template and make sure that comments.php
is also available in your theme folder.
在您single.php
要添加/显示评论模板的位置。这将comments.php
在single
模板中添加/包含该文件,并确保该comments.php
文件也在您的主题文件夹中可用。
Also you can use Disquswordpress plugin, it's a very nice plugin.
你也可以使用Disquswordpress 插件,这是一个非常好的插件。