Organizing Theme Files
While WordPress themes technically only require two files (
index.php in classic themes and
index.html in block themes, and
style.css), they usually are made up of many files. That means they can quickly become disorganized! This section will show you how to keep your files organized.
. ├── assets (dir)/ │ ├── css (dir) │ ├── images (dir) │ └── js (dir) ├── inc (dir) ├── template-parts (dir)/ │ ├── footer (dir) │ ├── header (dir) │ ├── navigation (dir) │ ├── page (dir) │ └── post (dir) ├── 404.php ├── archive.php ├── comments.php ├── footer.php ├── front-page.php ├── functions.php ├── header.php ├── index.php ├── page.php ├── README.txt ├── rtl.css ├── screenshot.png ├── search.php ├── searchform.php ├── sidebar.php ├── single.php └── style.css
There are no required folders in classic themes. In block themes, templates must be placed inside a folder called templates, and all template parts must be placed inside a folder called parts.
style.cssshould reside in the root directory of your theme not within the CSS directory.
It’s best practice to internationalize your theme so it can be translated into other languages. Default themes include the
languages folder, which contains a .pot file for translation and any translated .mo files. While
languages is the default name of this folder, you can change the name. If you do so, you must update