[英]How do I effectively get WordPress comments to display on home page?
我可以让评论显示在主页上,但我有 3 个非常大的错误。 使用 if 语句消除了其中一个错误。 我正在使用 Yoko 主题。 在 index.php 中,我在<?php get_template_part( 'content', get_post_format() ); ?>
之间插入了一个代码片段<?php get_template_part( 'content', get_post_format() ); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
和<?php endwhile; ?>
<?php endwhile; ?>
. 插入的代码是: <?php if ($withcomments != 1) { $withcomments = "1"; comments_template(); } ?>
<?php if ($withcomments != 1) { $withcomments = "1"; comments_template(); } ?>
<?php if ($withcomments != 1) { $withcomments = "1"; comments_template(); } ?>
。
我遇到的问题是第一篇博客文章的评论显示在文章本身之外。 另一个问题可能与显示评论无关,所以我不会在这里发布,但它涉及一些与评论重叠的图片。 您可以在 www.flyfishingpursuits.org 上查看(如果它们仍然存在)正在运行的问题。 请不要在页面上发表任何评论。 我正在为其他人做这件事,请保持您在网站上的“足迹”不存在。 谢谢你。
我会使用 wordpress get_comments() 函数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.