I introduced you to the "The whole process of WordPress theme production (1): Basic preparation". This article continues to bring you the "The whole process of WordPress theme production (2): Theme file composition" 》, let’s take a look at it~
Before you start making a WordPress theme, you must first understand what files the WordPress theme consists of. You must know how the WordPress program is connected to the theme files.
The following are all template files in the default folder of WordPress default theme. After looking at the picture below, you may still be confused as to what these files are for. WordPress themes are written in PHP, not pure HTML CSS, so the suffix of the template file is .php. If you want to be proficient in WordPress theme production and perfectly control your blog, it is best to be familiar with PHP programming. What if you don’t know how to program in PHP? Can’t you make a WordPress theme? That’s not the case. At least after reading this series of tutorials, you will be able to master the basic WordPress theme creation methods.
The following is the WordPress theme file hierarchy, which will tell you: When WordPress displays a specific page type, which template file will be used? Only by understanding the following theme hierarchy can you know what files you need to write for your WordPress theme.
Take the homepage as an example. There are two files home.php and index.php below. The WordPress program will search for these two files in sequence from your theme folder:
home.php
index .php
Post page:
single-{post_type}.php - If the post type is videos (i.e. video), WordPress will look for single-videos.php (supported by WordPress 3.0 and above)
single.php
index. php
index.php
Recommended study: "WordPress Tutorial"
The above is the detailed content of The whole process of WordPress theme creation (2): theme file composition. For more information, please follow other related articles on the PHP Chinese website!