Getting Comments to Display on Home Page of a WordPress Site

By Ryan Florence, published 2009-12-29

Part of the issue Migrated Articles From Original Site Structure..

To get your comments to display on the home page, front page, index page–whatever you want to call it–you have to first force the comments_template to believe there are comments. Somehow it is already being forced to believe that because it is the homepage there are no comments.

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

Now whether it’s being viewed from single.php or index.php or a custom front page, it’ll show the comments.

I did this because I totally tweaked WordPress to be a CMS + product catalog. The comments are simply product inquiries that never display, just notify the site admin. Pretty slick. Typically it’s a bad idea if your site generates much feedback on a post.

Hi, I'm Ryan!

Location:
South Jordan, UT
Github:
rpflorence
Twitter:
ryanflorence
Freenode:
rpflo

About Me

I'm a front-end web developer from Salt Lake City, Utah and have been creating websites since the early 90's. I like making awesome user experiences and leaving behind maintainable code. I'm active in the JavaScript community writing plugins, contributing to popular JavaScript libraries, speaking at conferences & meet-ups, and writing about it on the web. I work as the JavaScript guy at Instructure.