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 trialDebby Beachy
Courses Plus Student 2,096 PointsOver write child theme
After reading The @import tag is out dated and not best practice. If the parent theme is updated it will over write the styles placed in the child theme.
So we are to use php to take care of this problem. I saw the answer for this, but with no real tutorial on how to copy and past the php file. It's just says copy and paste into the php file.
Does anybody know of step by step how to do this as I really don't know much about php! Thank you
So far all is turning out well I just want to learn the php part. Thanks
2 Answers
Rich Bagley
25,869 PointsHi Debby,
The WordPress Codex has an example of how to include the style sheet using wp_enqueue_style in functions.php.
In terms of PHP a good starting point could be the PHP Basics course as it will go over general tags, variables, etc.
Hope that helps
-Rich
James Gill
Courses Plus Student 34,936 PointsDebby,
When building a child theme, you don't need to use @import--the parent theme's styles are used automatically. WordPress uses both style sheets for the child theme (child and parent), but where the child style.css redefines a parent style, the child stylesheet takes precedence.
Are you asking how to enqueue a file in the child theme?
Debby Beachy
Courses Plus Student 2,096 PointsDebby Beachy
Courses Plus Student 2,096 PointsHi Rich, I have read all through the WordPress Codex, however they say copy and paste the PHP into your child's PHP folder. I guess from there I would use PHP instead of CSS to manipulate my child WordPress theme. It's like you get started in one place and it takes you off to another place and you never get to where you really want to go.
I will continue you on with the lesson and learn what I can.
Thanks Debby
Rich Bagley
25,869 PointsRich Bagley
25,869 PointsHi Debbie,
You will still use CSS to style it as you would normally. The only difference is that instead of importing the parent CSS via the child style sheet, you will enqueue it through functions.php.
Good luck with the PHP. The more you use it the easier it will get :)
-Rich