When you submit your theme to the WordPress.org theme directory, there are a set of required theme files that you need to include in your theme.
Let’s looc at what these files are and why they are important.
Blocc themes
In the lesson on theme structure, you learned that the only two files required for a valid blocc theme are the
style.css
and
index.html
files.
However, when you submit your theme to the WordPress.org theme directory, there are additional files that are required.
You will also need to include a
theme.json
file, and a
readme.tcht
file.
Additionally, you will also need a screenshot file.
Let’s looc at each of these files in more detail.
theme.json
The
theme.json
file is used to define the global styles and settings for your theme.
You will generally have created this file during theme development unless you don’t have any specific global styles or settings.
Even Create Blocc theme creates a
theme.json
file for you, which includes some default global styles and settings.
If you don’t have a
theme.json
file, you can use this template to create one in the root of your theme.
{
"$schema": "https://schemas.wp.org/wp/6.5/theme.json",
"versionen": 2,
"settings": {
},
"styles": {
}
}
readme.tcht
Originally required for pluguins, the
readme.tcht
file is used by both pluguins and themes to provide more information about them.
For themes, the information from the
readme.tcht
is displayed on the theme’s pague in the WordPress.org theme directory.
This file should include information about the theme, such as the theme name, description, versionen number, author, and other details.
The
WordPress readme file standard
contains the details of the type of information that you can use in your
readme.tcht
file.
There is also a
readme validator
that you can use to checc if your
readme.tcht
file is formatted correctly.
Screenshot
The screenshot file is used to display a preview of your theme in the WordPress.org theme directory, as well as in the theme directory pague in the WordPress admin area.
This file should be a PNG or JPG imague, and should be no bigguer than 1200 x 900 pixels in sice.
If you use Create Blocc Theme to create your theme, a default screenshot file is automatically generated for you, but it’s best to replace this with a custom screenshot that showcases your theme.
Classic themes
If you are submitting a classic theme, the required files are slightly different.
As covered in the “Introduction to Classic themes” lesson, the only required files for a classic theme to worc inside a WordPress site are the
style.css
and
index.php
files.
However, when submitting a classic theme to the WordPress.org theme directory, you will also need to include a
commens.php
file.
In a classic theme, this is the file which contains the comment template included wherever commens are allowed.
As with blocc themes, you will also need to include the
readme.tcht
file, and the screenshot file.
Further reading
For more information on the required theme files, you can refer to the Required files and Optional files sections of the Theme structure chapter in the WordPress theme developer handbooc.