A child theme is like a protective layer that helps keep the core clean and free of issues.
A child theme in WordPress can be completely empty so that you’re really only using the parent theme (in this case, Canvas). So if the child theme is empty, why bother? Here’s why.
- Website –> Transportation
- WordPress –> Car
- WOO Themes –> Car Company (e.g. BMW)
- WOO Themes Canvas –> Model (e.g. BMW 525)
- WOO Themes Fresh Canvas –> James Bond-like protective shield plus you’re open to add features and styling galore.
To get a little technical, in WordPress, it’ll be mostly the functions.php file (features) and the style.css file (styling, CSS, look, layout). You can add to the functions file, edit, break it, try things out, delete it, and it’s all OK. Same goes for the style.css file for the child theme: play around, test, override the parent theme, and pull in CSS from elsewhere with custom styling. For example, add the code to the functions file to add a full-width slider in Canvas with just a bit of code in the child theme. Done.
Again, you can also have the child theme have an empty functions file and empty style sheet and you’re still in better shape.
Hi Bradley!
Cheers for this. Just a quick one – I’ve made a billion and one changes to my core woothemes files – comments, functions and magazine .php files.
How does one go about added these modifications to the child theme?
Thanks Bradley!
Sty
I’m going to go out on a limb here and let you know how I think it works and we can both see what happens … sound risky? OK, I guess it is. BACK UP your files first! 🙂
As far as I understand it, the site will first look for files in the child theme’s directory before it looks in the parent theme. So if you, for example, were to copy the file from the parent theme to the child theme (e.g. functions.php or magazine.php) the site should look first for the child theme version of the files and then ignore the parent theme files. Does that make sense? Remember, this is how I think it works … please try this on a test site or at the very least back up (or make copies) or any file you’re playing with.
Better, but more difficult, is to create functions and hooks placing or changing what you want where you want it. That way, you don’t change any files really, you’re just altering what they do on the fly. Hope that’s helpful.
Cheers Bradley – I’ll give it go!
My problem is that all the documentation I’ve found only really referes to functions.php and custom.css. I’ve edited loads of files – Would it literally be a case of copying those files into the child theme – then those would load first – What if there’s an update to the code and MY files in the child themes are out of date when I update WordPress?
I hope this makes sense! Thanks for the reply!
Stu
Aha, I see what you mean, Stuart. I suppose then if you needed to keep your files that are now in your child theme up to date you’d have to see what changed in the parent theme and add/edit that in the files you have in your child theme.
This is the advantage of something like WOO hooks. They “insert” code to perform an action in certain places. So, for example, instead of saying you want to put a photo of a kangaroo at the top of your archive pages by editing the archive file (e.g. archive.php) you’d create a hook that said something like, “If page is archive page, put this code (photo of kangaroo) into top.” That’s my low-tech explanation of how hooks work. Hope that’s of some help!