Recently, I started to dig deeper into WordPress theme development to know the WordPress core.
So, these blogs are a way to document my journey.
Let's get started...
If you go into your WordPress website file manager you might see something like the below:-
Here as you can see, apart from the wp-content folder, the rest are mostly core WordPress files that you don't need to touch.
Now, if you go to wp-content -> themes, you will see all your themes for your wordpress website.
As you know that WordPress is divided into 2 sections.
One is the pages section. And one is the post section.
With that in mind, a WordPress theme has these basic files:-
- style.css - Even though it's a CSS file, it's mainly used to store the theme-related information like theme name, author, URL, etc. That information is shown like this in theme section:-
Following is the example format for style.css.
/* Theme Name: Fictional University Author: Sanjit Author URI: https://sanjitchakrabarti.com/ Version: 1.0 */
single.php - This is the file that governs how all your blog posts will be designed.
footer.php - This is for the footer section.
header.php - This is for the header section.
page.php - And then as you can guess from the name, this is for the pages section.
index.php - This is the default file for the WordPress theme homepage. If Theme is not able to find files like single.php or page.php, then it loads this file to show the homepage of your website.
functions.php - Here you add all your backend code. Code added here will indirectly affect the front-end changes. For example, all the style and script files are added here to load on the front end.
screenshot.png - You might think that file is simply added to use somewhere on the website. But this file is actually used to show picture of your theme in your WordPress theme section.
Well, these are the main files that you need to know to get started on your theme development journey.
Of course, we will add more files in the future as needed, but these are the essential files for WordPress theme development. By controlling these files, you can manage the theme easily.
Look forward to day 2, where we will deep dive into all the files above.