Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

caroline
caroline
6,974 Points

Is this video out of date?

As someone has pointed out in the answer to another question below, it seems that the method shown here for creating child themes is now out of date. The new method is outlined in the codex here: https://codex.wordpress.org/Child_Themes. I was wondering if Treehouse has any plans to update this video (I've tried following the codex, but as my parent theme has multiple css files, it suggests I need to "maintain all of the Parent Theme dependencies" in a functions.php file. As I don't yet know PHP I have no idea what this means or how to do it!).

Also, I wondered if it is OK to still follow the old method using @import for now, even though the codex is says it is no longer best practice. Are there any implications of doing this that people should be aware of. I haven't found much on Google.

Many thanks! Caroline

1 Answer

Bob Sutherton
Bob Sutherton
20,160 Points

Maintaining the parent theme dependencies is just a fancy way of saying to import ALL of the parent's CSS files into your child theme. You said your parent theme has multiple CSS files so you will want to make sure your child theme gets them as well, otherwise your child theme would not have the styles you leave out.

@import is, like you said, not considered a best practice. It appears to have something to do with site speed. Here are some links.

That second link compares @import with the <link> tag which isn't really germane here but I just think it's about pagespeed. So the recommended way is to do it through functions.php as you noted. It's really a good thing to know how to do and not that PHP intensive. Of course, since you don't know PHP it's going to seem confusing but if you follow along with an instructional video you can do it.

In the 'WordPress Theme Development' course Zac does use the new method and in some other places as well such as the Workshop video where he is showing you how to integrate a Zurb Foundation site with WordPress.

caroline
caroline
6,974 Points

Thanks Brock - I really appreciate your thoughtful response. Those links look really helpful, and I'll have a go at using the PHP method with their help. It's also good to know that the sky isn't going to fall in if @import is used, but I get the fact that it's better to do this using PHP. I'm going to check out the new PHP for Wordpress course when it's released as I think that will be really useful for me to start to get my head around it.

Thanks again! Caroline