WordPress – Child Themes
WordPress is beautiful and it has fully arrived on mainstream. Now, I find WordPress based websites in the most unusual places (translation: rich companies), that it only makes a lot more sense for smaller organizations to have WordPress based sites for ease, SEO capabilities, easy to learn CMS, and oh well to establish a blog. Originally designed as a blog engine, now the WordPress has become a way to generate websites and writing one’s own stylesheet to make the site unique. There comes another beauty of WordPress – its ability to create a Child Theme.
Customizing WordPress Theme
Once WordPress is installed and you want to make your site unique from the default style, you have basically 3 options:
- Edit the Style.css of default theme
- Add Custom.css on the default theme
- Create a Child Theme
Option 1 of editing default style.css is not a good idea because when the WordPress is periodically updated, all the changes would be gone. While adding custom.css is a better option it only allows CSS changes. A Child theme not only provides ability to update CSS styles but also functions and lot more abilities.
What is a Child Theme?
As the name suggests, the Child Theme, inherits style and functionality from its “Parent Theme”. In a generalized case, the Parent Theme could be WordPress’s default theme, say Twenty Eleven or Twenty Ten, and each developer can build a child theme based upon the parent theme by modifying or adding the style/functionality of the parent theme. Using a child theme allows bigger control over the code without risk of messing up the original WordPress codes.
How to Build a WordPress Child Theme?
- Start by creating a folder/directory inside the Parent Theme. For example, if you are creating a Child Theme for Twenty Eleven, your new folder should go into hosting_root/wp-content/themes/twenty-eleven/child1.
You can give a valid name to your child theme. - Create a style.css file (Details below) and add your styles here. You must have style.css in a child theme.
- Create a functions.php – any additional functionality goes here. This is optional.
- Template file and other files – this is for advanced users only and we are ignoring it for this blog.
- Once Steps 1 to 4 is completed, login to WordPress, and go to Theme Options and you will see a new theme available. activate it and
Sample Style.css in a Child Theme
Consult WordPress documentation for details, but here is the quick sample, without getting into too much details.
/* Theme Name: Twentyeleven Child Description: Child theme for the twentyeleven theme Author: Your name here Template: twentyeleven */ @import url("../twentyeleven/style.css"); #site-title a {color: #009900;}
WordPress Development With WordPress
Since web development has become so easy with WordPress, we are building many websites using the free blog engine which makes our clients happy for the CMS they receive as well as great SEO abilities.
Contact us to see samples of WordPress based websites.