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

Add new template files - WordPress Tutorial

From the course: WordPress: Building Child Themes

Start my 1-month free trial

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…

Contents