proper wordpress folder structure

Proper WordPress Theme Folder Structure

In this article I will explain to you my WordPress Theme Folder Structure

As a web developer we all need to have Proper WordPress Theme Folder Structure or WordPress theme directory. We all need to have a good, clean, easy to navigate, folder structure to our projects. Whether you’re using a CMS like WordPress, or PHP frameworks like Laravel, Codeigniter or CakePHP. Whilst PHP frameworks have clean folder structure, we still need to have a clean template folders. Trust me, you will improve your productivity when you are following a folder structure.

Here’s my WordPress Theme Folder Structure

I prefer to have my assets, custom functions and templates in a separate folder. Either I’m building a WordPress theme or a WordPress plugin. I still follow my folder structure to keep track of my files and increase my productivity.

Wordpress Theme Folder Structure
WordPress Theme Folder Structure

So, inside my child theme I have the following folders: assets, inc and templates. These are the folders that are needed for startup. Unless if you’re working with Woocommerce plugin then you should probably have have a woocommerce folder included inside your WordPress child theme for woocommerce template customization. And, if you will be using node js then, your node_modules folder will be added inside the child theme as well.

Wordpress Theme Folder Structure,wordpress child theme folder structure,wordpress theme development folder structure
This is how my WordPress Theme Folder Structure look on editor

Assets

Assets folder contains all the assets of the WordPress child theme or the website. Here are the following folders inside assets:

css folder will include all my css files.

js folder will include all my js files.

fonts folder will include my fonts, icon libraries or custom icons that I need.

img folder is where I store my static images like a loader gif, SVGs, animated SVGs, texture images and any images that doesn’t need to be dynamic.

Inc

Inc folder is where I keep my custom functions like theme support functions, filter functions, do actions, shortcode functions etc. For example the enqueue.php file is the file where I enqueue or where I load my css/js files. I also keep them separated so that I could only edit the files that I need.

Templates

Templates folder is where I save my templates file. For example I or my clients will have a custom layout for a specific section, or maybe I need to have a different look on my posts and pages then I can create a layout and just call the file from this folder directory. Using the WordPress get_template_parts() function to call the file and is never been easy. This folder is basically where I save my template files.

Download my WordPress Theme Folder Structure

You can download my WordPress Theme Folder Structure on github. Download here