I’m looking for a way to let users comment categories on category.php, but I haven’t been able to find one. Simple pasting didn’t do the trick (didn’t really expect it to.)
For clarification, I’m not looking for users to comment posts in category.php, but rather to comment the category itself. Is it possible?
Short answer: No, it is impossible, if we are talking about WP way, because it was not provided by WP architecture.
It could be done if you create your own plugin (or implement it as a part of theme). To do it you need to create custom table and implement logic for saving comments and displaying comments.
This isn’t possible out of the box because WordPress can only handle comments on posts, in the broad sense which includes pages, custom post types, etc.
Because a category is a group of posts rather than a post per se, there’s no built-in functionality to attach comments to a category.
If you have relatively few categories, you could create a page for each category. Have them use a custom page template including a custom loop to get the category members, and including a comments form.
You can redirect standard category links to this page using the ‘category_link’ filter.
Create a custom page
With your own customized loop
Enable comments on that page.
It won’t have the same Url.
It can be done with the same url and the original -without custom tables- wp-comment system but it’s much harder.
If you want that ask and I’ll look into it.
It’s not possible with the default comment system of WordPress
In order to print the comment form, you have to put the function comments_template() inside your category.php template file.
Unfortunally, this function “will not display the comments template if not on single post or page, or if the post does not have comments”.
Solution with a third-party comment system (e.g Disqus)
If you use an other comment system, it is very likely that this system does not take into account the WordPress structure (pages, posts, categories, etc.), but instead relies only on URLs: each site URL can have its own stream of comments.
For example, if you have Disqus installed on your blog, you could create a category.php file like this one:
I created the template from the one suggested in How to Create Category Templates in WordPress; I added the comments using the snippet suggested in Manually install Disqus on WordPress.
The code is tested on my own website and it works.