Show comments on wordpress home page

筅森魡賤 提交于 2019-12-22 05:16:10

问题


So I've inserted the following code to the template loop (in the correct place) but it is not outputting any comments. Any clue why?

<?php
$withcomments = true; // force comments form and comments to show on front page
comments_template( '', true );
?>

I'm trying to display comments for each post on the main-home-page stream of posts.

EDIT: Just for the record, I'm using twenty ten theme.


回答1:


Try this before the <?php endwhile; ?> of the loop in loop.php:

<?php
  $withcomments = "1";
  comments_template();
?>



回答2:


Try this:

<?php global $withcomments; $withcomments = 1; comments_template(); ?>


来源:https://stackoverflow.com/questions/6205002/show-comments-on-wordpress-home-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!