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 trialnolwennleme
370 PointsName of the theme don't change after copy in the child themes's folder
I don't understand how the name can be changed. I copied and paste the style.css from my theme that I download from the servor. When I copy this files on the themes child folder, I open it but the "Theme Name" doesn't change and I haven't the "Template" line.
What is the problem ? Can you explain me please ? Thanks you ! ;-)
7 Answers
Andrew McCormick
17,730 Pointswhen you create a child theme you shouldn't need to ever edit the parent theme files again. To create the the child theme create a folder in your themes folder with the name of child theme. You then create the style.css file. To do so, just create a new file named style.css. This will be blank. To add the comment information at the top ( between the /* */), just simply type it out. There's not magic or automation to it. If you download the projects files from the video stage here: http://teamtreehouse.com/library/how-to-make-a-website-with-wordpress/customizing-wordpress-themes/how-to-make-child-themes you will see what the style.css file for the child theme looks like. In the case of the project files, the parent theme is Twenty THIRTEEN , so you will need to change that to Twenty FOURTEEN in your files, since Twenty Fourteen is your parent theme.
Is that making sense?
Andrew McCormick
17,730 PointsI think I understand what you are asking. To create a child theme you do not need to copy anything from the parent theme to the child theme folder. So your structure may look something like this: wp-content/ - parent_theme_folder/ - functions.php -style.css -page.php -etc
- child_theme_folder/ <--- note that the child theme folder name is different than parent
-functions.php <-- can be blank
- style.css <-- a new css file, not copy of parent.
Then your child themes style.css will look something like this:
/*
Theme Name: My Child Theme <<---- this gives Wordpress the name of your Child theme
Description: this is a child theme
Author: Me
Template: parent_theme <<---- this is the name of the theme that this child theme depends on (the parent theme)
Version: 1.0
*/
@import url("../parent_theme_folder/style.css"); <<----- this imports the parent's stylesheet into the child theme's stylesheet.
hope that helps.
Zac Gordon
Treehouse Guest Teacher+1 For Andrew's point.
However, do you mean that you downloaded the style.css file from the project downloads for this video or from the parent theme?
Can you post up the CSS that you're using for your child theme please.
nolwennleme
370 PointsHi everybody.
I don't understand how create a new style.css with the information between /* */ are include directly. If I create style.css in my child theme folder, the file is empty and If I copy the file style.css from the project (localy) or transfer the file from the servor are exactly the same. First, do I need to customize the parents file style.css with the information of my website like (I buy a premium theme but I try to do first with a free wordpress theme). Sorry to disturbed you, but i'm a little bit lost ! :-) Thanks.
nolwennleme
370 PointsThis is my parent theme style.css
/*
Theme Name: Twenty Fourteen
Theme URI: http://wordpress.org/themes/twentyfourteen
Author: the WordPress team
Author URI: http://wordpress.org/
Description: In 2014, our default theme lets you create a responsive magazine website with a sleek, modern design. Feature your favorite homepage content in either a grid or a slider. Use the three widget areas to customize your website, and change your content's layout with a full-width page template and a contributor page to show off your authors. Creating a magazine website with WordPress has never been easier.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: black, green, white, light, dark, two-columns, three-columns, left-sidebar, right-sidebar, fixed-layout, responsive-layout, custom-background, custom-header, custom-menu, editor-style, featured-images, flexible-header, full-width-template, microformats, post-formats, rtl-language-support, sticky-post, theme-options, translation-ready, accessibility-ready
Text Domain: twentyfourteen
This theme, like WordPress, is licensed under the GPL.
Use it to make something cool, have fun, and share what you've learned with others.
*/
nolwennleme
370 PointsI think that I have understand alone. Nothing was automatic. You must create the style.css with the comment to import the parent information ! Thanks for helping me I have very appreciate !
nolwennleme
370 PointsYes ! Perfect ! It's a confirmation that I have understand before alone ! So Thanks you very much !