8.1 WordPress Theme Structure

WordPress themes follow WordPress conventions while organizing custom code in a maintainable way. We separate template files, PHP classes, and assets into logical groupings that make it easy to locate and modify specific functionality.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
wp-content/themes/project-theme/
├── assets/
│   ├── sass/
│   │   ├── base/
│   │   ├── components/
│   │   ├── layout/
│   │   └── pages/
│   ├── js/
│   │   ├── components/
│   │   ├── modules/
│   │   └── main.js
│   ├── images/
│   └── fonts/
├── build/
│   ├── css/
│   ├── js/
├── includes/
│   ├── classes/
│   │   ├── Theme.php
│   │   ├── AssetLoader.php
│   │   ├── CustomPostTypes.php
│   │   └── CustomTaxonomies.php
│   ├── functions/
│   │   ├── setup.php
│   │   ├── enqueue.php
│   │   └── customizer.php
│   └── admin/
├── template-parts/
│   ├── components/
│   ├── navigation/
│   └── content/
├── templates/
│   ├── page-landing.php
│   └── single-portfolio.php
├── functions.php
├── index.php
├── style.css
└── README.md

The includes directory contains all PHP logic organized into classes and functional groupings. This separation keeps template files focused on presentation while maintaining clean, testable PHP code for business logic.

Template parts are organized by their purpose rather than just following WordPress naming conventions. This organization makes it easier to find and reuse template components across different page types.


Copyright © 2025 Crowd Favorite. All rights reserved.

This site uses Just the Docs, a documentation theme for Jekyll.