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

WordPress

Comments_template

I finished the Wordpress Theme but there are some gaps unfilled around the course.

I wanted to know how to modify the structure of the comments.

As we created a comments_template(); others tutorials show how to change the comment type of Wordpress.

So how can I customize it? Like to remove date, change title, etc.

Thanks for the help.

2 Answers

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hey Sergio Sala! Awesome to hear that you finished the theme course, but even better that you're digging deeper into things. Basically, WordPress automatically includes a default template that you can customize or overwrite using WP's built in comment related tags. Here's a few resources for working with the comments template in WP:

Hope that helps!

Mike Bronner
Mike Bronner
16,395 Points

These are good pointers. Unfortunately none of them help me in my current dilemma: I am unable to get the comments.php in my theme folder to be used for displaying comments.

    global $withcomments;
    $withcomments = 1;
    comments_template(get_template_directory_uri() . '/comments.php', true);

This and other variations, like omitting any arguments altogether do not load my custom comments template, but always load the default system comments template. Any ideas what I might be missing?

Mike Bronner
Mike Bronner
16,395 Points

Figured it out. If you add comments.php to your theme folder, and are unable to get results, it is likely that you're comments template is being intercepted by a plugin via hooks. To clear any interference with comment templates add the following to your functions.php:

remove_all_actions('comments_template');