[英]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.