WordPress Ninja Tricks

,

WordPress Setup

Create a WordPress Child Theme The Easy Way

Need to create a WordPress child theme?

Create a WordPress Child Theme

WordPress child theme is a theme that inherits functionality from another theme called parent theme. Child theme is a great way to modify existing theme without changing the original files.

When to use child theme?

You should use child theme when:

⚡️ You want to make changes to style files
⚡️ Add functionality
⚡️ Modify theme, but still want to keep original files when the theme is updated


1. How to Create a WordPress Child Theme Automatically

Install One-Click Child Theme WordPress Plugin.

Using the plugin

Once you have installed and activated the plugin, the themes menu will have a new sub-menu called “Child Theme”. Clicking on this gives you a form that will allow you to create a child theme based on the current active theme. Once you have followed the process you can deactivate and delete the plugin as it will not be needed anymore unless you intend to make child themes of other installed and activates themes.

2. How to Create a WordPress Child Theme Manually

Creating child theme is pretty easy.

Create on your server or local machine empty directory. You can name it whatever you want, but the best practice is to use parent theme directory name with “-child” appended to it. This directory should be placed under wp-content/themes. For example child theme directory for “Medicate” theme should be named “medicate-child”

Child theme requires only one file – valid child theme style.css file. Using text editor create new style.css file. This style sheet file must start with this header: 

/*Theme Name: YOUR THEME NAMETheme URI: THEME URLDescription: CHILD THEME DESCRIPTIONAuthor: AUTHOR NAMEAuthor URI: ABOUT AUTHOR URLTemplate: PARENT THEME DIRECTORY NAMEVersion: CHILD THEME VERSION*/

EXAMPLE BELOW:

/*Theme Name: WP Fix ItTheme URI: https://www.wpfixit.comDescription: WP Fix It Child themeAuthor: Jarrett GucciAuthor URI: https://www.wpfixit.comTemplate: wpiVersion: 1.0*/

This header is used to tell to which parent theme is your child theme related.

Child theme style.css will override parent theme style.css . If you wish to modify parent theme style.css, simply copy it inside child theme directory and add header. Now you can change colors, styles, fonts and other elements, without interfering with parent theme style.css .

If you wish to include parent theme style, you will need to include it into child theme css. To do that simply add this line just after child theme header:
@import url(“../PARENT-THEME/style.css”);

Please note that all CSS definitions should be added after @import . Otherwise, CSS changes will not have any effect.


Activating child theme

Child theme can be activated as any other theme. If you have done everything correctly, your theme should be listed in “Themes” panel (“Appearance” -> “Themes”). All information (theme name, author) are displayed on this screen.

Now you know how to create a WordPress Child Theme The Easy Way!

  1. This plugin has been closed as of July 5, 2019 and is not available for download. Reason: Guideline Violation.

Leave a Reply

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

QUESTIONS