VizRED Digital

Helping businesses all over the world get found online.

  • Home
  • About
    • About Vizred
    • Meet The Team
  • Services
    • Social Marketing
      • Social Media Training
    • Local Search Marketing
      • Google Places Optimization
      • Local Directories Submission
    • Mobile Marketing
      • Text Message Marketing
      • QR Code Marketing
    • Social Media Consulting
      • Blogger Outreach
      • Facebook Contest
    • Web Development
      • Membership Sites
      • Q&A Forums
    • Social Media Public Speaker
    • Search Engine Optimization – SEO
  • Portfolio
  • In The Media
  • Blog
  • Contact Us
    • Request Call Back
  • Support
    • Q&A Forum
    • WordPress Tips
    • Video Tutorials
  • Español

Be Good to Your Theme, Give it a Child

WordPress themes are stored in /wp-content/themes. This means they are not WordPress core files; and that means we can edit them.

Uh oh! Themes update. What happens to file edits when our theme updates? They get overwritten.

How do we protect theme file edits?

Themes come in two classes:

  1. Parent themes
  2. Child themes

Parent themes consist of page template files, theme images, Javascript libraries, style sheets and other files. These files are used by WordPress to provide the frontend — public facing — look of a site.

Child themes can be created with only one file: a stylesheet. This stylesheet tells WordPress that the child has a daddy and that daddy will supply all the other files that WordPress needs for the child theme to work.

Example Parent Theme Files

Example Parent Theme Files

Child Files

Example Child Theme Files

When a child theme is active, WordPress reads the theme’s stylesheet. The stylesheet has a line of text in it that tells WordPress where to look for the parent theme files.

Example WordPress Child Theme Stylesheet

Example WordPress child theme stylesheet

In the image above, the line that says “Template: Genesis” tells WordPress that the parent theme is Genesis. In other words, for this example child theme, the template (parent) theme that is being used is called Genesis and the child theme’s files are to be used in preference to the parent theme’s files.

How do child themes protect theme file edits?

We can copy files from the parent theme and put them into the child theme’s folder. WordPress will use the child theme’s files in preference to the parent theme’s files.

When a parent theme has a footer.php file and a child theme has a footer.php file, WordPress will use the child theme’s footer.php. The parent theme’s footer.php file will be ignored.

Child theme files are not overwritten when its parent theme updates.

When we want to edit files in a WordPress theme, we need to:

  1. make a child theme
  2. copy files we want to edit into the child theme’s folder
  3. edit the child files in the child theme folder (not the parent theme).

Is there an easy way to make child themes?

We can automate child theme creation by using a plugin to automate the process. Several plugins exist to do this. We recommend Child Theme Configurator.

1 - Install The Plugin

Install Child Theme Configurator

Install Child Theme Configurator from the WordPress repository. Go to Plugins > Add New and search for the plugin.

2 - Make A Child Theme

Make A Child Theme

Make a child theme by going to Tools > Child Themes.

3 - Choose Files to Edit

Copy Template Files From the Parent Theme to the Child Theme

Choose the files you want to edit.

There is no point duplicating all the parent theme’s files into the child theme’s folder. Only copy the files you will edit.

4 - Activate the New Child Theme

Activate the New Child Theme

5 - Edit the Child Theme With the WP Theme Editor

Edit Child Theme Files with the WordPress theme Editor

Sharing is caring!

Filed Under: Developers Beware!

About Lee

VizRED co-founder. Blogger extraordinaire. WordPress plugin developer. WordPress theme developer. Spreadsheet magician. Lee loves techy stuff and sci-fi.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blanca Wins Award At Latism National For Best Inspirational Blogger

Official LATISM Top Bloguera!

VizRED Social Stream

[dc_social_feed id="2042"]

Google Adds HTTPS to Its Search Rank Algorithm

Google now gives greater value to sites that use SSL encryption by default. Sites that use HTTPS connections will now see a light increase in their search result position, for now at least. In the words of Google's Zineb Ait Bahajji and Gary Illyes, Webmaster Trends Analysts, [over] the past few … [Read More...]

Be Good to Your Theme, Give it a Child

… [Read More...]

Rename Plugins When You Customize Them

What do we do when we need to add a new feature to a WordPress site and we find a plugin that does almost exactly everything we need of it? What if we know a little code tweak will turn that plugin into the exact super plugin we need? We can ask the plugin developer to add the feature. We can … [Read More...]

© Copyright 2013 ViZRED Digital Media · All Rights Reserved · Privacy Policy