Create A Child Theme Before You Modify Your Blog Or Website
I love the Graphene WordPress theme, and have written a series of posts on easy ways to modify the theme to better suite your website’s needs (like this article on how to create a simple “static” front page).
I’ve been messing with PhotoHow2′s WordPress theme lately, and decided that it would be a shame if a theme update erased all of the work that I’d been putting into getting my website to look just the way I wanted it. Creating a child theme allows you to modify your website’s style without actually modifying the theme’s core codes, and according to the WordPress Codex page on child themes, using them is the recommended way of making modifications to a theme.
Set up a new child theme in three easy steps:
- Open your favorite FTP client application (I use Cyberduck for Mac–it’s easy to use and open source) and navigate to your website’s home folder. Open wp-content/themes and create a new folder there (PhotoHow2 uses the free Graphene WordPress theme, so named my new folder “graphene-child”).
- Create a new file inside the graphene-child folder called style.css. To do this on a Mac I use a text editor called Sublime Text 2. After opening the text editor I go to File>>New and then File>>Save As and name the new file “style.css.” Then, I save the file to the desktop and then drag and drop the file into the “graphene-child” folder. But before storing the file on my server I…
- Copy and paste the following code into the newly created style.css file:
Theme Name: Graphene Child
Theme URI: http://example.com/
Description: Child theme for the Graphene theme
Author: Your name here
Author URI: http://example.com/about/
/* Your modification goes here */
Now, any time you want to make changes to your theme you can add or modify CSS properties in style.css–only new code needs to be added to the file. There’s no need to copy and paste the file’s original properties.
Wait–there’s one last step. Navigate to your website’s Dashboard>>Appearance>>Themes and activate the child theme (“search installed themes” for “graphene-child” and it will show up as an option).
That’s it! Now you can modify to your heart’s content without risking To learn more about WordPress child themes: WordPress.org–Codex: Child Themes
Notice After activating the child theme some of my theme adjustments disappeared. My footer image reverted back to default, my menu items changed, and my Google Adsense code (installed using the Graphene options) also vanished. The fixes only took a couple of minutes to complete–but be prepared for things to move around when you activate the new child theme.