Child Theme Generator

Child Theme Generator is a WordPress plugin, useful to generate child themes. A child theme is a WordPress template that inherits all features and characteristics of another theme, called the parent theme.

Creating a child theme, it allows you to edit and / or add functionality to your template without having to overwrite any of the parent theme files, risking making mistakes or losing your job when you make updates.

This plugin will generate a child theme in few steps, quickly and safely, it will not slow down your website or spam your database.

CREATE

For example, let’s try to create a child theme, named “The Green Giants”, for your website.

Go to “Settings”, then click on “Child Theme Gen”

Select a parent-theme from drop-down menu., then enter these details (all fields are optional):

  • Heading: enter an easy title to remember (i.e. ‘The Green Giants’)
  • Description: enter a sentence about your job (i.e. ‘Few tweaks to my baseball website’)
  • Child Theme URL: enter the URL where to find out more (i.e. link to your article or post)
  • Author: enter your name
  • Author URL: enter your blog or your website URL
  • Version: early version, usually 1.0
  • Include GPL License: choice if include or not the General Public License.

Click on “Create new child theme” button, and a message like this will be displayed:

Note: you can Activate your Child Theme just check on “Activate your xyz child-theme?“.
Lastly, click on “Finished” button to complete.

According to WordPress Codex, this plugin will generate one folder and three files:

  • child-theme folder
  • functions.php file
  • style.css file
  • screenshot.png image

 

child theme generator page 5

 

The functions.php file will look like this:

<?php
/*
This file is part of the-green-giants, a twentyseventeen child-theme
All functions of this file will be loaded before of parent theme's functions
Learn more at https://codex.wordpress.org/Child_Themes.
Note: this function loads the parent's stylesheet before then child-theme stylesheet
(leave it in place unless you know what you're doing)
*/
function the_green_giants_enqueue_child_styles() {
$parent_style = 'parent-style'; wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ),
wp_get_theme()->get('Version') );
}
add_action( 'wp_enqueue_scripts', 'the_green_giants_enqueue_child_styles' );
/*Write here your own customized functions */

The style.css file will be something look like this:

/*
Theme Name:   The Green Giants
Description:  Few tweaks to my baseball website
Author:       Serafino Corriero
Author URL:   http://serafinocorriero.it
Template:     twentyseventeen
Version:      1.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  the-green-giants
*/

/* Write here your own personal stylesheet */

And finally, screenshot.png will look like this:

REMOVE

This function will delete unwanted child theme, then it will switch to the parent theme.

It’s STRONGLY recommended to backup your files before continue, all deleted files will be lost!

Select the child theme to delete, then click on ‘Remove’ button:

 

Then, click on ‘Confirm’, a message like this will appear:

That’s all! Click on ‘Finished’ button to end.

Questions and Answers

For now I assume that all was fine, but what if something went wrong?

Below some common error messages:

  • Q: Theme root folder “/my/website/wp-content/themes/” is not writable.
  • A: Access to remote folder via FTP and try to setup folder permissions to 0755 , otherwise contact your Webmaster.

 

  • Q: Can’t to create style.css, functions.php and screenshot.png.
  • A: Also in this case, there are problems on root theme folder. Access to remote folder via FTP and try to setup folder permissions to 0755 , otherwise contact your System Administrator.

  • Q: Can’t create two child-themes with the same name
  • A: It’s no allowed creating two child theme with the same name, please choose a different name.

child theme generator duplicate

Changelog

  • v 1.0 (08/01/2016) – Initial Release

Download and Contribute

Child Theme Generator is available from the WordPress.org repository. You can download it by searching for “child theme generator” under Plugins – Add New and following the instructions. Or you can download it here:

http://wordpress.org/plugins/child-theme-generator/
You can also download and contribute to the code on GitHub:

https://github.com/Seraph63/child-theme-generator/

If you have any suggestions, please leave a comment below.

 

Lascia un commento