Do i need to keep all the default WP templates files in a theme?

I have a general question about the themes development.

When I develop a theme for distribution (free or commercial) is it a better practice to keep all the default templates file in my theme even though i do not use all of them ?

Read More

For exemple if i develop a theme without blog feature, is it a good practice to keep single.php, comments.php … files in my theme ?

I ask this question because when i test my themes with theme-check plugin, all the default templates files seems to be mandatory to pass the test.

What do you think ? what is the best practice ?
Thanks for your advices.

Related posts

Leave a Reply

4 comments

  1. It really depends:

    • What is the intended purpose of the Theme? Is it a “special use” Theme, or merely designed for static Pages but not for blog posts?
    • What is the intended distribution method for the Theme?

    If the Theme truly is a “special use” Theme, then you only need to include the template files relevant to the intended use. On the other hand, if you’ve merely designed a static-Page Theme, you really should take the 5 extra minutes required to ensure that the Theme also accommodates blog posts as well. The difference in underlying code between a static Page and a blog post is trivial.

    If the Theme is intended to be submitted to the official Theme repository, and is not a “special use” case, then it will be required to support both static Pages and blog posts. The Theme Check Plugin is intended specifically to indicate issues for Themes to be submitted to the official repository, and that therefore must meet the Theme Review guidelines. If you’re going to distribute the Theme outside of the repository, then the Theme Check Plugin test results are merely for your own use/information.

  2. Leave the files in.

    You designed the theme, but you don’t know how the people who download your theme will want to use it. I’m assuming it’s a beautiful, well designed, destined to be popular theme; won’t it be a disappointment if someone wants to use it for their corporate blog and cant?

  3. If it’s going to be distribuated then you should delete every single file not used in your template:

    • the final file will be lighter
    • the customer will find more easily the files he’ll want to modify to match his own needs (“where am I supposed to change [whateveryouwant]?”)
  4. No, you should include a bare minimum, although how extensive their contents are depends on you.

    For example, you would be forgiven for not including an image.php, since WordPress will fall back on to attachment.php, and so on.

    You must include an index.php, as it is the main fallback template, even if your theme is intended to use page.php and a custom home template ( home.php ).

    I suggest you keep the following files as a minimum regardless of usage:

    • index.php
    • functions.php
    • single.php
    • page.php
    • style.css