3

I am developing a theme and, after calling comments_template(), noticed that "Theme without comments.php is deprecated since version 3.0".

I created a comments.php in the root of my theme and copied the default wp-includes/theme-compat/comments.php inside, which is perfectly fine for me. This core file will be removed in future versions of wordpress.

I am not sure if this is a good practice for theme development, though, as it is a complex bunch of code and it does not belong to the website development core features. I prefer wordpress to provide a default comments template.

I could deliver the theme without the ability to enable comments, but that is even worse.

I can be called lazy, but apart from that, shouldn't there be a standard/default comments template?

1 Answer 1

8

You shouldn't copy that file, precisely because it is too bulky. About half of it is implementation of submission form, which was entirely replaced with comment_form() function around that time.

So the answer why was it deprecated is roughly:

  1. Newer code is more compact
  2. Markup belongs in theme

For better and more relevant comments.php example look at core themes, such as twentyfifteen/comments.php.

3
  • OK, so i will take comments.php of newest core themes as standard/base. Thank you
    – Marc
    Jan 30, 2015 at 8:56
  • I just wanted to throw a suggestion in to use underscores as an excellent starter theme. Feb 3, 2015 at 12:41
  • I switched to that style of comments.php but how do I login, that option seems gone.
    – Muskie
    Jan 27, 2019 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.