Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP How to Build a WordPress Theme Converting Static HTML into WordPress Templates Convert Blog Listing and Single Post Templates

comments_template() function causing error

Hi, I am new to wordpress and and have been following along with the wordpress theme development course with no problems*. In the blog listing lesson however I have run into difficulty with the comments_template() function.

In the video it appears as though you can just drop in this function and the comments section will automatically show however when I do this I get the following error:

"Theme without comments.php is deprecated since version 3.0 with no alternative available. Please include a comments.php template in your theme."

I assume that the video was recorded before 3.0 and so I thought it would be a simple matter of finding a standard comments.php template online that I could just drop into my theme however this proved not to be the case. Not only can I not find a standard file but the tutorials which I have found to set up a comments.php file go above my wordpress knowledge.

If you have a link to a comments.php file or a resource for beginners to set up there own I would be very appreciative.

Apart from this I have been enjoying the course and have learnt a lot.

Thanks, Ben

* Other than the bloginfo('siteurl') function being deprecated and having to use home_url() instead

3 Answers

Andrew McCormick
Andrew McCormick
17,730 Points

Are you making your own theme or creating a child theme? If a child theme then your parent theme should have a comments.php file. You can also find a comments.php file in all the default Wordpress themes (twentyeleven,twentytwelve, etc.) or you can download from the underscores child theme starter here: http://underscores.me/

Thanks for the reply, I'm making a parent template as per the course. I should have thought about getting a comments file from one of the default themes and I actually downloaded underscores.me earlier this morning! It would probably be pertinent to put a link to one of these files and a note on the lesson file that they are required to get the comments section to work.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

This is a new error to me, but I just saw it as well in a random theme from scratch. I had to create a comments.php file and copy and paste over from one of the default WP themes as suggested.