From the course: WordPress: Building Child Themes
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Add new template files - WordPress Tutorial
From the course: WordPress: Building Child Themes
Add new template files
- You can copy over any existing file easy enough but you can also create new templates that don't exist in your parent theme. Let's make a new template just for our recipes. We'll go to my code editor, and if my theme had a template for categories, I'd see it right here. But that doesn't exist. So instead, I'm going to start with archive.php and if you go back to the template hierarchy and click in, we can see if category.php doesn't exist then use archive.php. So this is the closest thing to category php. I'll copy archive.php. I'll paste it into my theme. But, I'm going to rename this. So I'm going to call it category and if I saved it just like this, it would apply to all of our categories, but I only want it to apply to a specific category. In this case, recipes. And I know this, because if I go back to the template hierarchy, we can see right here category dash dollar sign slug. So that is category dash the name of the category dot php. So category recipes. And now let's…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
- Ex_Files_WordPress_Building_Child_Themes_Starting_Site.zip
- Ex_Files_WordPress_Building_Child_Themes_2.zip
- Ex_Files_WordPress_Building_Child_Themes_3.zip
- Ex_Files_WordPress_Building_Child_Themes_4.zip
- Ex_Files_WordPress_Building_Child_Themes_5.zip
- Ex_Files_WordPress_Building_Child_Themes_6.zip
- Ex_Files_WordPress_Building_Child_Themes_7.zip