Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress How to Make a Website with WordPress Customizing WordPress Themes How to Make Child Themes

child themes

I'm working with a different theme than the instructor. When I try to make a child theme, it says I don't have all the right pieces (template, something else).

(Since I wasn't using the suggested theme, I couldn't use the file from the download, so I copied over the style.css file and just renamed it child theme.)

Why can't I just copy the entire theme, rename it child theme, and then transfer that over to wordpress?

5 Answers

Kristi Roberts, when making a Child Theme all you need is the style.css with the appropriate "header comments". For instance you're trying to make a child theme from the parent theme here's the code you need to place in your blank style.css file:

/*
 Theme Name:   Name of Child Theme
 Theme URI:    http://www.example.com
 Description:  Child Theme Description
 Author:       Your Name
 Author URI:   http://example.com
 Template:     parent-theme
 Version:      1.0.0
 Tags:         light
 Text Domain:  parent-theme-child
*/

@import url("../parent-theme/style.css");

Replace parent-theme with the name of the Theme. Hope this helps.

Andrew McCormick
Andrew McCormick
17,730 Points

because then it's not a child theme...lol joking aside there are many reasons.

-First, there's space. If you have a theme, and then you want to create a version of that theme where the background on every page is red. Then copying all those files for that theme, just to have a red version is quite a lot of space taken up on your server.

-Second, what if the theme author created an update for the theme (many premium themes do this). How are you going to track your changes to know what to redo in the updated version, especially when it comes to modifying templates and functions. For some modifications, this could take many hours to fix on the updated theme.

-Third speed. To copy a theme directory can take more than a couple minutes on your server. Then the speed factor for developing the site. If I'm changing CSS, I'd much rather look for the styles I updated in the 100 lines of custom css, than the thousands for the parent theme.

I'm sure others could come up with other reasons. codex: child themes

Now to your specific problem. If you still want to attempt:

  • make sure you are importing the parent theme's css into your child's style.css

  • make sure your links are correct

  • make sure your template name is correct in the child's style.css. Sometimes this is different than what is displayed in the Appearance-> themes page of WP. Try upper and lower case as well as hyphenating or concatenating two word themes.

Hope that helps.

thanks so much for the detailed reply and information. I get it now, this all makes sense.

Helps A LOT!!! Thanks so much!

Part of the problem was i didn't realize there were project downloads so I could see how to modify what the instructor provided. The code above really helps. But I think I'm going to go hire a developer, I'm losing days of my life. :)

Andrew McCormick
Andrew McCormick
17,730 Points

Kristi, We are here to help you learn if you want to continue on. However there comes a time in a project when having someone else do the work is best. Hence why I have a designer I work with for most of my clients. I know a little design and produce decent stuff, but I know that a designer is going to do a way better job and a lot quicker than I would.

thanks, Andrew! I'll reach out when I need a quote.