Upcoming events
- BlogathonATX (October 25th)
- The Freelance Conference (October 28th)
- Beginner’s WordPress class (Oct. 11th) taught by Jackie Dana
You break it, you buy it
presentation by Bobbie Wilson
Notes at http://www.bobbiejwilson.com/blog/wordpress/break-buy/
Child theme on WordPress Codex: http://codex.wordpress.org/Child_Themes
Creating a custom theme
When modifying a theme, best practice is to not modify the actual theme files but instead create a child theme. This way, when you update the theme, you won’t lose the changes.
You need:
- WordPress installed
- A free theme
- Text editor
- FTP program
Creating a Child Theme
Create a new folder for your theme anywhere you’ll remember.
Using a text editor, create a new file and name it style.css.
Inside the style.css file, you’ll add:
/*
Theme Name: Your Child Theme
Template: twentythirteen
*/
“Template” in the code above references the name of the directory of the parent theme
If you want to keep the styles of your parent theme:
@import url(“../twentythirteen/style.css”);
This imports the stylesheet of the parent theme; anything you modify will override the parent theme styles.
Create a folder with your css file on your computer and name it the name you want to use for your child theme. Compress that folder as a .zip folder. You can add it to your site by going to the Dashboard under Appearance > Themes > Add new theme and upload the .zip folder. Note that you must have the parent theme installed in your theme directory on the site or the child theme won’t work. Once the file is in the theme directory you should be able to activate the child theme.
You can also override the template files (e.g. page.php) of the parent theme by copying the files into the child theme folder and modifying them there.
Everything in the child theme folder overrides your parent theme.
Creating a child theme will not remove the additional theme-specific options that many themes build into the theme dashboard.
Tips:
- Don’t change your CSS or php template files in your Editor because you can break your site, and there’s no undo. Instead, make changes to files offline and upload them via FTP, so you have the ability to revert if necessary.
- If you get white screen of death, you can go into FTP and rename your wp-content/plugins folder to something else so the plugins don’t load.
- You can go into wp-config.php and set WP_DEBUG to true to find errors (more about this in the WordPress Codex)
- Create regular backups before making changes to your live site – do not rely on your hosting provider. That way if you break something you can revert to a backup.
Some ideas on backup plugins/services: