Site icon Osclass Documentation & Knowledge Base

How to create child theme

A child theme is a theme that inherits the functionality of another theme, called the parent theme. Child themes allow you to modify, or add to the functionality of that parent theme. A child theme is the best, safest, and easiest way to modify an existing theme, whether you want to make a few tiny changes or extensive changes. Instead of modifying the theme files directly, you can create a child theme and override within. For example, you will be able to have your bender theme, as a parent theme, and then create “my-bender-child”, containing only the files that are different from the bender.

How to

You could create a child theme the same way you create a regular theme, but there’s a big advantage, you only need to create the modified files in the child theme. For example, if you only want to modify the color of Bender theme, you could create a child theme with only a different style.css file. The rest of the files will be taken from the parent theme (in this case, Bender), that way, you could feel free to update Bender theme and your modifications will remain the intact.

Requirements

There’re two requirements.

/* 
...
Parent Theme: name-of-your-parent-theme-folder
...
*/

For example

/*
  Theme Name: Osclass CHILD Bender Theme
  Theme URI: http://www.osclass.org/
  Description: This is the Osclass CHILD bender theme
  Version: 1.0
  Author: Osclass team
  Author URI: http://www.osclass.org/
  Parent Theme: bender
*/