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 trialPiccia Neri
8,937 PointsChanged best practice for child themes
Hi there, the best practice for creating child themes has changed according to the codex: @import is not best practice anymore, see http://codex.wordpress.org/Child_Themes#Referencing_.2F_Including_Files_in_Your_Child_Theme Basically you need to create a functions.php file in your child theme's folder and enqueue the stylesheet there. This is simple enough, even though I don't really know php – but it gets more complex if your parent theme has more than one stylesheet, which is my case.
In this case, according to the codex, 'you will have to make sure to maintain all of the Parent Theme dependencies'.
I don't know how to do this. Would it be possible to get an updated version of this video, with the latest best practice? I have looked around and also had a look at https://developer.wordpress.org/themes/advanced-topics/child-themes/ but Im still not sure, as a non-php person, if Ive got all the steps clear when it comes down to customising my own child theme.
Would be really grateful for any help – I basically unpaused my subscription specifically for this.
Many thanks in advance!
Piccia Neri
8,937 PointsYes, basically I thin that's what I am asking! it's clear enough how to enqueue one – but the codex does not expand on how to add more. The theme I am using has an empty style.css with just the themes details, but then relies on bootstrap.css, screen.css and swipebox.css all in a css folder for the styling. I think I have an idea how to but not totally sure how to enqueue them.
Marcus Edvardsen
1,574 PointsI am really unsure if this is any help (Don't want to waste your time). In addition you asks for a solution to the dependencies problem. I do not have the the technical knowledge to understand the underlaying problems and therefore makes it hard to tell if this could be to any use.
Regarding dependencies It seems like the mor10.com-link discusses this fact quite well.
It seems like you are not afraid of digging in to this, so maybe it can be useful to you.
So here is some links I found about the subject: http://themes.simplethemes.com/skeleton/tutorials/how-to-add-custom-css-and-javascript-using-a-child-theme/ http://stackoverflow.com/questions/22249909/multiple-css-files-in-child-theme http://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/ http://premium.wpmudev.org/blog/adding-scripts-and-styles-wordpress-enqueueing/ http://mor10.com/challenges-new-method-inheriting-parent-styles-wordpress-child-themes/ http://stackoverflow.com/questions/22249909/multiple-css-files-in-child-theme https://wordpress.org/support/topic/theme-flexible-multiple-css-enqueue-for-child-theme
http://generatewp.com/register_style/
Best Regards M Edvardsen
Gabriel Ward
20,222 PointsGabriel Ward
20,222 PointsHi Piccia,
Are you asking how to enqueue multiple style sheets in the functions.php?