There’s always something about personalized WordPress Themes. You want to be able to update your wordpress themes to avoid version conflicts and use new features, on the other hand you want to change elements in the code or even delete parts of the code. The changes made on the template of course shouldn’t be lost when you update yozr template version. Luckly WordPress has a simple and nice solution for this: the childtheme. In the following article i will explain how to create your own childtheme in three simple steps.
Create a new folder on the same level as you have your parenttheme (wp-content/themes). You can name the folder as you want, you only need to be sure not to use space character or any special kind of character.
Insert the following code into a new css file (name it style.css) that you’ll save into the recently created folder. Remember, the comments on the top of the css file are important for wordpress to recognize your work as a childtheme.
Theme Name: my childtheme Description: yay, i can create childthemes on my own Author: Angela Bachmann Author URI: http://www.stonelab.ch Template: name-parent-theme-folder Version: 1.0 Tags: */ @import url("../name-parent-theme-folder/style.css");
This step is optional, but it helps to keep your backend nice and clean. Create a preview of your childtheme and save it (600px * 450px) as screenshot.png in the folder of your childtheme. That way your theme also receives a nice preview image as the other templates have.
Congratluations! You just created your own childtheme. That was easy, rigth? Before you can use your childtheme you need to activate it as your current template in the backend and you need to know the following things: If you’ll now activate your childtheme as your active template nothing on your page should change so far. It will only change when you start editing the css file in your childtheme. The styles that you define in your childtheme will override the ones that are defined in the parenttheme. That’s how you can change stuff in your template without loosing them when you update to a new version of you theme. If you not only want to edit styles you can just copy files from your parentthemes (for example header.php) and insert it in the childtheme. The changes you’ll do now in the header.php of the childtheme will affect your page. So wordpress gives the files in your childtheme a higher priority as the files in you parenttheme.